Tree layout

I have a diagram where I have to order to tree the knots.
Some knots have the side link and others the superior link and I should get a diagram with this layout:

0
|-----1
|
2
I have the following instead result:
0
|____
| |
2 |---1
how can I succeed in getting a layout that I desire?
I have used this following function:
Public Sub TreeAutoLayout(ByVal doc As GoDocument) Dim Layout As GoLayoutTree = New GoLayoutTree Layout.NodeIndent = 44 Layout.Document = doc Layout.SetsPortSpot = False Layout.SetsChildPortSpot = False Layout.Path = GoLayoutTreePath.Destination Layout.Arrangement = GoLayoutTreeArrangement.Horizontal Layout.ArrangementOrigin = New PointF(20, 20) Layout.ArrangementSpacing = New SizeF(50, 50) Layout.Angle = 90 Layout.BreadthLimit = 0 Layout.LayerSpacing = 50 Layout.NodeSpacing = 20 Layout.RowSpacing = 25 Layout.Compaction = GoLayoutTreeCompaction.Block Layout.Alignment = GoLayoutTreeAlignment.CenterChildren Layout.NodeIndent = 0 Layout.Sorting = GoLayoutTreeSorting.Descending Layout.AlternateDefaults.LayerSpacing = 0 Layout.AlternateDefaults.CopyInheritedPropertiesFrom(Layout.RootDefaults) Layout.Style = GoLayoutTreeStyle.Layered Layout.Document.StartTransaction() Dim obj As GoObject For Each obj In Layout.Document If (TypeOf obj Is GoLink) Then Dim link As GoLink = CType(obj, GoLink) If Not link Is Nothing Then link.AdjustingStyle = GoLinkAdjustingStyle.Calculate End If End If Next Layout.PerformLayout() Layout.Document.FinishTransaction("tree node") End Sub

Do you actually have two different kinds of relationships between the nodes? Is that why you want nodes like #1 to be treated differently from nodes like #2, even though they are both connected to #0?

What is supposed to happen with #1's children -- where should they be placed? What should happen when there are a lot of nodes like #1?
In any case, for this kind of sophistication, you'll need to override some methods of GoLayoutTree, but I'm not sure what you want.

there are then 2 types of children for every father:

  1. child with port middleleft
  2. child with port middletop
    I need to create a level of priority for the children type 1 and to position them in the tree to a superior level of children type 2.

I still don’t know what you want to happen when those #1 nodes have children of their own.

I suggest you explicitly create a GoLayoutTreeNetwork (from your document, to assign to the Network property) and insert a dummy node as the pretend parent of all of the #2 nodes. This way the tree layout will be operating on a graph that is different from the graph in the document, causing the dummy node to be positioned in the first layer below #0, and the #2 nodes beneath that dummy node.

i need to create this layout where the black are node #1
and blue node type #2
but root are node #0

I think what I suggested (inserting a dummy node into the GoLayoutTreeNetwork) is the right strategy. I haven’t tested this to make sure, though.