Dojo Diagrammer supports nested graphs,
that is, it can render graphs containing nodes that are graphs.
A graph that is a node in another graph is called a subgraph.
Links that connect nodes of different subgraphs are called intergraph
links. In Recursive hierarchical layout on nested graph with
polyline link style, all red links are intergraph links
and all black links are normal links. This is explained in detail
in Nested layouts.
Hierarchical layout can treat a nested graph at once,
placing all nested nodes and routing all links including the intergraph
links.
To enable recursive mode:
Use this method:
layout.setRecursiveLayoutMode(enable);
Recursive layout mode requires that all subgraphs are
laid out in the same style. For example, they must all use the same
flow direction. This happens automatically when you do not specify
individual layouts per subgraph. If different layout styles are needed
for each subgraph, you must specify an individual layout per subgraph.
For details, see Advanced recursion: mixing different layouts in a nested
graph.
In this case, hierarchical layout cannot route the intergraph
links and you must use a Link Layout algorithm to route the intergraph
links.

Recursive hierarchical layout on nested graph with
polyline link style

Recursive hierarchical layout on nested graph with
orthogonal link style
Setting layout parameters in recursive mode
In recursive layout mode, the hierarchical layout is
attached to the top-level graph. Global layout parameters must be
set on this layout instance. Layout parameters per node or per link
must be set in the following way:
var sublayout = new ibm_ilog.graphlayout.hierarchical.HierarchicalLayout(); subgraph.setNodeLayout(sublayout); // The configuration of per node or per link parameters must be // done after attaching the layout to the subgraph sublayout.setSpecNodeLevelIndex(node, 5);
This means that layout parameters per node or per link
cannot be set on the top-level layout, but must be set on the sublayout
that lays out the subgraph.
Layout constraints in recursive layout mode work only
between nodes that belong to the same subgraph. Constraints among
nodes of different subgraphs are ignored. The concepts EAST, WEST,
NORTH, SOUTH of extremity constraints are interpreted relative to
the subgraph, not relative to the global graph. Similarly to the layout
parameters per node or per link, the constraint must be installed
at the layout instance of the subgraph of the node.
// node1, node2 is directly contained in subgraph var sublayout = topLevelLayout.getRecursiveLayout().getLayout(subgraph); sublayout.addConstraint(new ibm_ilog.graphlayout.SameLevelConstraint(node1, node2));
Swim lane constraints do not work in recursive layout
mode at all.