Anton Sherwood wrote:
Anton Sherwood wrote: I refined it slightly:
val,vec = numpy.linalg.eig(adj) indx = val.argsort()[-4:-1] val = val.take(indx) vec = vec.take(indx, axis=1) master = zip(val, vec.T)
Charles R Harris wrote:
But that won't get the 4 largest, and will ignore the last eigenvalue, whatever it is. . . .
Are you making two points here or only one?
I'm using eigenvectors of a graph's adjacency matrix as "topological" coordinates of the graph's vertices as embedded in 3space (something I learned about just recently). Whenever I've done this with a graph that *does* have a good 3d embedding, using the first eigenvector results in a flat model: apparently the first is not independent, at least in such cases. So, yeah, I really did intend to throw away the largest and use the next three. Are you saying this code doesn't give me that? The output of my first few test cases looks good.
No, it's just that in previous emails you had stated that you wanted the four largest eigenvalues and said nothing about actually wanting to throw away the largest of the four. Sometimes people get confused with Python's (and thus numpy's) indexing, so Charles wanted to make sure you knew what [-4:-1] actually did.