epfl-lts2 / pygsp

Graph Signal Processing in Python
https://pygsp.rtfd.io
BSD 3-Clause "New" or "Revised" License
483 stars 93 forks source link

Auto calculation of Laplacian Eigenmap throws error #59

Closed scottgigante closed 4 years ago

scottgigante commented 4 years ago

I think this might be my own fault from when I added the truncated eigendecomposition.

import pygsp
G = pygsp.graphs.RandomRegular()
G.set_coordinates(kind='laplacian_eigenmap2D')
G.plot()

throws

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-338-4a8fe3272aa9> in <module>
      2 G = pygsp.graphs.RandomRegular()
      3 G.set_coordinates(kind='laplacian_eigenmap2D')
----> 4 G.plot()

~/.local/lib/python3.7/site-packages/pygsp/graphs/graph.py in plot(self, vertex_color, vertex_size, highlight, edges, edge_color, edge_width, indices, colorbar, limits, ax, title, backend)
    897                            edges=edges, indices=indices, colorbar=colorbar,
    898                            edge_color=edge_color, edge_width=edge_width,
--> 899                            limits=limits, ax=ax, title=title, backend=backend)
    900 
    901     def plot_signal(self, *args, **kwargs):

~/.local/lib/python3.7/site-packages/pygsp/plotting.py in _plot_graph(G, vertex_color, vertex_size, highlight, edges, edge_color, edge_width, indices, colorbar, limits, ax, title, backend)
    382     check_2d_3d = (G.coords.ndim != 2) or (G.coords.shape[1] not in [2, 3])
    383     if G.coords.ndim != 1 and check_2d_3d:
--> 384         raise AttributeError('Coordinates should be in 1D, 2D or 3D space.')
    385     if G.coords.shape[0] != G.N:
    386         raise AttributeError('Graph needs G.N = {} coordinates.'.format(G.N))

AttributeError: Coordinates should be in 1D, 2D or 3D space.

and on inspection, G.coords.shape == (64, 1).

scottgigante commented 4 years ago

Nevermind, I had a version that was newer than the latest PyPi version, but older than master. Sorry for the noise!

mdeff commented 4 years ago

No problem. Thanks for reporting issues. We actually discovered that bug in #53 and fixed it in #54.