[SciPy-user] matrix construction

J josh8912 at yahoo.com
Fri Sep 24 20:12:39 CDT 2004


Hello Stephen:
I found something that might be of use.  The Matlab
file "FindConnectedComponents.m" listed at
http://www.cs.tau.ac.il/~borens/courses/ml/code.html
might be what you are looking for.  It takes an
adjaceny matrix as input and finds the connected
components.  
Best,  John


--- Stephen Walton <stephen.walton at csun.edu> wrote:

> On Thu, 2004-09-23 at 08:29, William Griffin wrote:
> > I'm trying to build an adjacency matrix (52*52)
> 
> Maybe this is so obvious that I'm missing what
> you're trying to do:
> 
> from string import *
> from numarray import *
> A=zeros((52,52))			# adjacency matrix
> file=open('data')
> for line in file.readlines():
>    w = split(line)
>    m = atoi(w[0])
>    n = atoi(w[1])
>    A[m, n] += 1
> 
> I've gotten in the habit of using m,n instead of
> i,j, by the way because
> of i and j being the sqrt(-1) in MATLAB and
> Numeric/numarray,
> respectively.
> 
> Now, does anyone have code to draw a connectivity
> graph from an
> adjacency matrix like this?
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com



More information about the SciPy-user mailing list