Computing Fiedler Vector in Python

How to find laplacian (L) filer vector in Python?

I can get eigenvalues ​​and eigenvectors using: eigenvalues, eigenvectors = linalg.eig (L)

I assume python does not return eigenvalues ​​in order.

Do I take the second largest eigenvalue, and then compare it with the corresponding eigenvector (matching in index)?

When you order your own values, how do I handle negative values? Is ordering by absolute value?

thanks for the help

+5
source share
1 answer

Well, I don’t know what about mathematics, but I will do my best.

, linalg.eig , .

- :

w, v = linalg.eig(L)
seen = {}
unique_eigenvalues = []
for (x, y) in zip(w, v):
    if x in seen:
        continue
    seen[x] = 1
    unique_eigenvalues.append((x, y))
fiedler = sorted(unique_eigenvalues)[1][1]

Python , .., , (-2 < -1 ..). , , .

, , , .

+3

All Articles