SubGraphs, SubGraphs, SubGraphs


SubGraphs are one of the more powerful features of GoDiagram. When applied correctly they have the potential to add a wealth of usability and information into simple views. Since in another discussion SubGraphs are on the table for enhancement - I’d like to make two requests… the first is for anything that makes SubGraph construction and connectivity more flexible…
and the second…
the ability to apply customized layout options to individual SubGraphs with the autolayout options for one SubGraph being different than that of another SubGraph…
As you can see I rooting for the growth of SubGraph support in Go a lot… its a GREATidea and feature…
Joe Licata


OK, here’s a snapshot of a new sample app, SubGraphApp. (Clever name, eh?) Download:
The sample lets you create three different kinds of GoSubGraph classes. You can drag into or out of a subgraph by holding down the Shift key. There are some controls for editing some of the relevant subgraph-specific properties. It will also show all the nodes/links/ports that are associated with the selected object.
The TreeSubGraph example class has a Port that has the same bounds as the GoSubGraph’s Handle.
The CustomSubGraph example class has a Port that has the same bounds as the whole subgraph. The port is implemented by a GoBoxPort, so that links always come in/out orthogonally and spread out evenly along the side. The port is also smarter about having links coming from/to ports inside the subgraph connect in the opposite direction from the normal direction on the outside.
You can specify the roundedness of corners and a shadow (these properties are part of the new GoSubGraph–they’re not part of this example class). When collapsed the labels are shortened with ellipsis to fit in a fixed size. This collapsed size (only in the CustomSubGraph example) is specifiable in some controls in the sample app.
The MultiPortSubGraph example class supports an arbitrary number of ports along any of the four sides. In the sample app, the Add Port command creates new ports on each side in turn. The MultiPortSubGraph can be selected and dragged by the margin, which is shown by the border (width 10).
The MultiPortSubGraphPorts used to adorn the MultiPortSubGraph are distributed evenly along each side. They are rendered using hexagons. They support the notion of being for “input” or for “output”–ones on the left or on the top edge of the subgraph are “input” ports, ones on the bottom or right are “outputs”. When the subgraph is collapsed, these ports do not become invisible, but are just repositioned appropriately in the margin.
There is also a button to perform a recursive layered-digraph autolayout. I suppose we could extend some of these classes to customize the autolayout within each subgraph.
We have made a number of improvements to GoSubGraph; this includes a Port property, the aforementioned Corner and Shadowed properties, improvements to label positioning when the LabelSpot is at a corner, a bunch of overridable methods to make customization easier when collapsing and when expanding, having the standard implementation remember the paths of links when collapsing and restoring them upon expansion, and enumerators for looking at the nodes/ports/links that are external to the subgraph.
Of course, things may change before GoDiagram 2.2 comes out. Your comments are appreciated.


I have updated the with assemblies compiled for .NET 1.0. There may be some other minor changes too.


With the subGraph example and what I am piecing together through the demo1 example - I think I am beginning to feel comfortable… subgraphs -an enormously useful node… its just getting the visual aesthetics right… also the new updated exampe does not contain any source… Can you include the .cs and project files?
And here is what I think will be useful… applying layout to subgraphs… how do we appy layout to individual subgraphs… any examples? this will be enormoulsy helpful… can it be done the same way it is applied to a view???
Thanks … Joe Licata


The sources will be included in the kit; the problem with releasing them now is that they depend on new features in 2.2.
The “Layout Document” button just does a recursive walk of the document, first performing an autolayout of the children of each subgraph, and then doing the whole document. You could easily customize the behavior for each individual node, such as changing the direction and/or spacing for a layered-digraph autolayout. Or you can just have the button operate on the currently selected subgraph nodes.


Hi Walter,

The features in the Demo app is what we have been looking for, how soon can we expect 2.2.?



We should start beta in a few weeks.