This sample displays a bow-tie 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.

The Diagram.layout is an instance of the DoubleTreeLayout extension layout, defined in extensions/DoubleTreeLayout.js. The layout requires a DoubleTreeLayout.directionFunction predicate to decide for a child node of the root node which way the subtree should grow.