Collapsible sub-graphs

Dec 19, 2012 at 11:44 AM

Hello,

I tried to use an expander in the data template for BorderViewModel, but there is now way the subgraph nodes are included in the expander content. From what I saw in the code, it seems the border and the content of the border are part of different layers, stacked via various z-index values.

I would like to know if there is any plan to add support for collapsible sub-graphs in the current version of the library. It is not only about UI: this should comme together with an edge prunning algorithm (the edge set should be different when the subgraph is collapsed).

Many thanks,

Andrei

 

Coordinator
Dec 19, 2012 at 9:27 PM

Hi there,

the thing is that Graphviz4Net uses GraphViz as a backend, so it actually is mainly about UI and interfacing with Graphviz. So what this means with regard to your questions: 

It would be nice to create a new canvas for each sub-graph and then put its vertices onto the new canvas, the only technical difficulty is that Graphviz tells us coordinates of each node (edge, etc...) with respect to the origin (left top corner*) of the whole drawing, so it would be needed to re-calculate these coordinates to make them relative to the sub-graph and then use them to place the vertices into the canvas corresponding to that sub-graph. That could be fairly easy (take a look on class WPFLayoutBuilder) and it would be nice thing to have in Graphviz4Net. Nonetheless, it gets bit tricky for edges, because there might be edges that go from one sub-graph to another: onto which canvas should we put such edge?

As with the edge pruning algorithm (and online re-layouting in general), it's the business of Graphviz, so if you wanted to adjust the layout when user collapses something you would need to invoke Graphviz, which takes some time... So as i said in some other thread i believe, interactive re-layouting is definitely possible, but i am not certain about the performance. Graphviz4Net is definitely more suitable for layouts that don't change that often. 

Btw. collapsible nodes are used here: http://patterns4net.codeplex.com/, but it does not re-layout the graph when a node is expanded/collapsed.

Hope this helps,
Steves

* if i remember it correctly