GoSubGraph Layout

Hello,

I am actually using the GoSubGraph component to arrange my nodes.
This GoSubGraph can contains other GoSubgraphs, links, nodes, etc recursively.

When I perform the layout on a doc with several GoSubGraph containing inners GoSubGraph the operation is very slow, can you give me the best practices to improve the layout mechanism.

Thank you for your answer

Are you doing the autolayout the way the the SubGraphApp sample does?

Can you give me a rough idea of the number of nodes and subgraphs you have?

Hello

Thanks for your answer,

The code is based on the SwimLane sample.

The goal of our application is to create conditional nodes as IF nodes (the ones display in the picture). Those nodes are composed of two branches, and several links to build the node design. The links and points used for the node design are set manually every time the layout is called. We also want to synchronise the height of the two branches. When the user adds a node in a branch the other one has to adapt it’s size, this is also made when the layout is called.

To realize the layout we have to browse recursively all the nodes to call their layout method, in order to refresh the design components.

The layout is made as following:

foreach (GoObject obj in coll)
{
GoSubGraph sg = obj as GoSubGraph;
if (sg != null)
{
if (sg.IsExpanded)
{
LayoutGraph(sg, doc);
}
}
}
GoLayoutLayeredDigraph layout = new GoLayoutLayeredDigraph();
layout.Document = doc;
layout.DirectionOption = GoLayoutDirection.Down;
layout.Network = layout.CreateNetwork();
layout.Network.AddNodesAndLinksFromCollection(coll, true);
layout.PerformLayout();

There is also code in the GoSubGraph and branches to set the position of the different design objects.

Best regards.

Looks like you got that Layout code out of SubGraphApp. If I construct an “equivalent” graph in the SubGraphApp sample (similar set of nodes and subgraphs), the Layout is done by the time the mouse goes up on the click to do the Layout.

So I guess I'd recommend setting some breakpoints, perhaps at the "PerformLayout()" call and see if something pops out...

I answer to your recent internal mail to Bishop.

We haven’t time enough to change totally our layout architecture. We have base our diagram on SwimLane sample.

We have found a little part of the reason for the slowness (expand/collapse SubGraph) : each subGraph is calling the Doc.Layout() if the SubGraph is or not expanded…!

As Bishop said, we want to create a workflow of actions, we have also a main GoBranch (starting by a GoNode “Start” and ending with a GoNode “End”), a lot of GoNodes (each containing at least a XML string) plugged on the GoBranch. But one of our “Node” can be a conditional node like IF/WHILE, therefore we use a GoSubGraph with 1 or more branches (IF = 2 branches, one for then part and the other for the “else” part)…

You don’t want to call Layout on a SubGraph that is Collapsed. Note the SubGraphApp sample has a flag (myLayoutExpandsAll) that controls whether LayoutSubGraphs should expand all the subgraphs while doing the layout.

OK Jake…
But if you want to expand all the subgraphes contained in a subgraph ?
You have to call Layout…

I’ll check the SubGraphApp sample again.