pmacg / pycheeg

Sweep set algorithms for finding cuts in networkx graphs.
MIT License
2 stars 0 forks source link

Error when doing cheeger cut on graph with n=2 vertices #1

Open SteinarLaenen opened 2 years ago

SteinarLaenen commented 2 years ago

When trying to run pycheeg.cheeger.cheeger_cut(G) with two vertices I get a type error from scipy:

TypeError: Cannot use scipy.linalg.eigh for sparse A with k >= N. Use scipy.linalg.eigh(A.toarray()) or reduce k.

Some code to reproduce the error:

d = 1
n = 2
G = nx.random_regular_graph(d, n)

cut_value = pycheeg.cheeger.cheeger_cut(G)
pmacg commented 2 years ago

Thanks for the report - I know why this is :) I'll fix it when I move this code into SGTL. For now you'll have to calculate the two-vertex case yourself :P