Interactive nodes - show/hide sub-nodes on-click


I am working on a network graph using Dash Cytoscape and wanted to ask if there is a way to make sub-nodes show/hide upon clicking the parent node?

I have for example a 3 layer network like this:

               /    \
             /        \
       NodeB          NodeC
         /\            /\
      /    \          /    \ 
NodeD    NodeE    NodeF   NodeG

My goal is to load this network graph with NodeD/E/F/G all hidden. When either NodeB or NodeC is clicked, it will expand its subnodes. Clicking again, would collapse the subnodes.

Is this possible ?

1 Like

Hello @einarmar,

You could probably just remove or add the nodes based upon the click toggle.

Hi @jinnyzor, thanks for the answer. I had wondered about that also, just wanted to check from the community if there are other ways, something more builtin and ready.
I will then just give your suggestion a try

Not sure if this translates, but you might be able to give this a shot:

1 Like