Genogram children order problem

In the following example, key 4,5,6 should be on right, but it show on left

      { key: 0, n: "Father", s: "M", ux: 1},
      { key: 1, n: "Mother", s: "F", vir: 0},
      { key: 2, n: "Son", s: "M", m: 0, f: 1},
      { key: 3, n: "Son", s: "M", m: 0, f: 1},
      { key: 4, n: "youngest son", s: "M", m: 1, f: 0, ux: 5},
      { key: 5, n: "and his wife", s: "F", vir: 4},
      { key: 6, n: "their child", s: "M", m: 5, f: 4}

Second example, oldest son should be on left

      { key: 0, n: "Father", s: "M", ux: 1},
      { key: 1, n: "Mother", s: "F", vir: 0},
      { key: 2, n: "oldest Son", s: "M", m: 0, f: 1, ux: 3},
      { key: 3, n: "and his wife", s: "F", vir: 2},
      { key: 4, n: "Son", s: "M", m: 1, f: 0}

How to solve this order problem?

That Genogram sample uses LayeredDigraphLayout, which cannot guarantee any ordering within a layer.

If you really want to control the ordering of the children or a marriage, you could try using a TreeLayout, which supports sorting the children. However a genogram that fans out from a person showing ancestry as well as descendants is not tree-structured, and will probably not be handled well by TreeLayout.

Thanks walter for your reply.
Is there a TreeLayout that can show father and mother?
There will be a T shape connecting father, mother and their child/children.
(father and mother are in the same level.)

You can replace the Diagram.layout with a TreeLayout and see the results. Replace LayeredDigraphLayout.direction with TreeLayout.angle and LayeredDigraphLayout.columnSpacing with TreeLayout.nodeSpacing. (I hope I got those names right.)