Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Cytoscape : Extend and Collapse tree


I’m trying to use Cytoscape to build a tree from collected data’s which can be extended or collasped when the user click on a node.

I saw in the documentation, an exemple which provide the “extend” function and I was wondering if an exemple with the “collaspe” function existed ?

Thank you

I’m trying to figure that out too… I Will let you know if I find anything.

If I’m understanding the render correctly… when you click a node, it expands with the edges and other dict elements in the ‘elements’ object. I think you’d need to add a call back on the node click maybe even number of times? Then deconstruct the dict to find all the edges and remove them from the ‘elements’ object. That should get you back.

I’ll keep trying.


Sorry I didn’t update this topic.

Normaly I find a solution to collapse the cytoscape graph.

For this, I used a recursive function to go through all the element that are linked to node I click on.

If you need some help, I will try to post my function this week-end :slight_smile:

Have a nice day