This sample displays a diagram of two trees sharing a single root node growing in opposite directions. The immediate child data of the ROOT node have a "dir" property that describes the direction that subtree should grow.

Unlike many GoJS apps, there is no Diagram.layout assigned. Layouts are performed in code -- a separate TreeLayout for each subtree. Each tree layout works on a subset of the nodes. The separatePartsByLayout function produces two separate collections of Nodes and Links, one for each direction, and thus one for each tree layout.