Cytoscape : Extend and Collapse tree

Hi,

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.

Hi,

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

Yes please!

I was able to come up with a way to retrigger the entire tree after making updates (e.g. remove a node). Glad to info share :slight_smile:

Hi mr_pony,

Sorry it goes off my mind with school and work.

You can see below my function, you will probably need to tweak it to make it work for you. I hope the comments will be enough to help you !

Moreover this function is not perfect with how I implement the recursive function, so i’m sure if you use it you will be able to improve it :slight_smile:

Sorry again for my lateness