How to apply Tree Layout

I was applied the tree layout to the diagram.And the node are connected in the reverse direction
Actual OutPut:

Expected Out Put:

By default GoJS thinks trees are composed of nodes connected by links that go from the parent to the children.

Set Diagram | GoJS API to false when you initialize your diagram:

        isTreePathToChildren: false,