epfl-lts2 / pygsp

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

maybe a bug about extract_components(self) #93

Closed cuminx closed 3 years ago

cuminx commented 3 years ago

Hi,I try to use the extract_components(self) to get the connected components,but it always return the graph which I input. Then I read the source and find the code 'stack = set(np.nonzero(~visited)[0])' that build a stack with all nodes in graph, maybe it should be 'stack = set([np.nonzero(~visited)[0][0]])'? I think the stack should have only one node at the beginning, so that it can split the connected parts. Is that right?

微信截图_20201225175209
mdeff commented 3 years ago

Thanks for reporting! That was fixed in #42. Unfortunately, the versions on pypi and conda don't contain the fix yet. You can install with pip install git+https://github.com/epfl-lts2/pygsp.

If you feel like contributing, it would be great to have a unit test for that function, so we don't break it in the future. :)