Auto Layout node position and line route

Are GoJs has function or feature to automatic-layout an diagram like below image?

If has are it support for diagram with group like below?

Yes, use a Diagram.layout that is an instance of LayeredDigraphLayout, Layered Digraph Layout Also set LayeredDigraphLayout.setsPortSpots to false, so that the layout uses the spots defined on the nodes.

Use a Node template that sets { fromSpot: go.Spot.BottomSide, toSpot: go.Spot.TopSide }.

Use a Group template that looks the way that you like and that also sets Group.layout to null. This causes the Diagram.layout to apply to all non-Group nodes in the diagram, as if the Groups did not exist.

Use a Link template that sets Link.routing to go.Link.Orthogonal.