paulbrodersen / netgraph

Publication-quality network visualisations in python
GNU General Public License v3.0
660 stars 39 forks source link

Collapse and expand descendents of node on click #60

Closed a-arbabian closed 1 year ago

a-arbabian commented 1 year ago

Hey again, I have another use case that I did not see in the examples. For a tree (networkx.DiGraph to be specific), I want to be able to collapse/expand a node's descendents on click. I can work on this implementation sometime this week, but just wanted to see if you forsee any matplotlib or InteractiveGraph limitations that would prevent this feature. Or maybe there is already code for this that I missed.

Thanks!

paulbrodersen commented 1 year ago

I have thought about building that but it really only works for graphs that are trees so I dropped the idea, as at the time, I only wanted to add features that are more generally applicable. I did implement a class were you could merge/unmerge (?) nodes to construct hypergraphs on the fly. However, nobody ever seemed to use that feature so I eventually removed it again as it made a number of other things very complicated. The code is extremely unlikely to work with present versions of netgraph but the commit where I removed the class and hence contains the last working version is here if you are interested.

paulbrodersen commented 1 year ago

I am closing this issue for now as I doubt I will implement this feature in the library. However, if you did get it to work and you want to show your work, then the gallery/tutorial section might be a good place for it.