iVis-at-Bilkent / cytoscape.js-expand-collapse

A Cytoscape.js extension to expand/collapse nodes for better management of complexity of compound graphs
MIT License
123 stars 32 forks source link

Preserve collapsed node to span expanded dependency level #143

Open ten3roberts opened 3 months ago

ten3roberts commented 3 months ago

If you have a parent node which contains multiple nodes of different dependency level, the node in expanded (normal form) will occupy the necessary dependency levels (I.e stretched wide across the graph assuming left-right).

However, when collapsed the node will only occupy one rank/dependency level and will thus either be placed at the lower or higher dependency level, which creates edges which go backwards.

Ideally, I'd like for collapsed nodes to still be able to stretch across their contained dependency levels, which would better signify the timespan in which the node will execute (for a rendergraph), as the current approach does not reflect the span of time the node will be executing and possibly blocking resources like image attachements.

The same behavior persists across different configurations of elk, klay and other topological layouts. I am mostly using the graph as completely collapsed, and only expanding as necessary

See graphviz for similar and intended behaviour https://forum.graphviz.org/t/make-large-nodes-span-multiple-ranks/1555/6

Example:

image image

I would like the longer C group to "encompass" the graph like above and correctly reflects the multiple dependency levels rather than choosing a single one.

Would a solution for this be to not remove the children nodes, but rather just set them to invisible?

Thanks for the help.

ten3roberts commented 3 months ago

Edit: I may add that this becomes of particular importance when you have cycles in compound nodes, as spanning them would mean you don't have arrows going backwards in the opposite direction but rather just vertically.

For example, with C0 -> A0 and A1 -> C4