Family tree layout with Eclipse ELK












0














I'm trying to use ElkJS to calculate the layout for a family tree and getting pretty decent results. However, I can't seem to get the T-style intersections working.



Consider a family with 2 parents (P1, P2) and 3 children (P3, P4, P5). I added a fake node R1 with 1x1 size to which all other nodes are connected, and this is the ELK JSON I am using:



{
"id": "root",
"layoutOptions": {
"elk.algorithm": "layered",
"elk.direction": "DOWN",
"elk.edgeRouting": "ORTHOGONAL",
"elk.layered.mergeEdges": true
},
"children": [
{
"id": "P1",
"width": 100,
"height": 50,
"layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
"ports": [
{ "id": "P1:e", "layoutOptions": { "elk.port.side": "EAST" } },
{ "id": "P1:w", "layoutOptions": { "elk.port.side": "WEST" } }
]
},
{
"id": "P2",
"width": 100,
"height": 50,
"layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
"ports": [
{ "id": "P2:e", "layoutOptions": { "elk.port.side": "EAST" } },
{ "id": "P2:w", "layoutOptions": { "elk.port.side": "WEST" } }
]
},
{
"id": "P3",
"width": 100,
"height": 50,
"layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
"ports": [
{ "id": "P3:n", "layoutOptions": { "elk.port.side": "NORTH" } }
]
},
{
"id": "P4",
"width": 100,
"height": 50,
"layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
"ports": [
{ "id": "P4:n", "layoutOptions": { "elk.port.side": "NORTH" } }
]
},
{
"id": "P5",
"width": 100,
"height": 50,
"layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
"ports": [
{ "id": "P5:n", "layoutOptions": { "elk.port.side": "NORTH" } }
]
},
{
"id": "R1",
"width": 1,
"height": 1,
"layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
"ports": [
{ "id": "R1:n", "layoutOptions": { "elk.port.side": "NORTH" } },
{ "id": "R1:s", "layoutOptions": { "elk.port.side": "SOUTH" } }
]
}
],
"edges": [
{ "id": "E1", "sources": [ "P1:e" ], "targets": [ "R1:n" ] },
{ "id": "E2", "sources": [ "P2:w" ], "targets": [ "R1:n" ] },
{ "id": "E3", "sources": [ "R1:s" ], "targets": [ "P3:n" ] },
{ "id": "E4", "sources": [ "R1:s" ], "targets": [ "P4:n" ] },
{ "id": "E5", "sources": [ "R1:s" ], "targets": [ "P5:n" ] }
]
}


Expected result:



Expected



Actual result:



Actual



I'm implementing an app that draws arbitrary trees from user input. Therefore, the best solution should not rely on explicit port side specification.



It it possible to fix this?



P. S. Useful link to a visualizer to play around with the JSON: https://rtsys.informatik.uni-kiel.de/elklive/json.html










share|improve this question



























    0














    I'm trying to use ElkJS to calculate the layout for a family tree and getting pretty decent results. However, I can't seem to get the T-style intersections working.



    Consider a family with 2 parents (P1, P2) and 3 children (P3, P4, P5). I added a fake node R1 with 1x1 size to which all other nodes are connected, and this is the ELK JSON I am using:



    {
    "id": "root",
    "layoutOptions": {
    "elk.algorithm": "layered",
    "elk.direction": "DOWN",
    "elk.edgeRouting": "ORTHOGONAL",
    "elk.layered.mergeEdges": true
    },
    "children": [
    {
    "id": "P1",
    "width": 100,
    "height": 50,
    "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
    "ports": [
    { "id": "P1:e", "layoutOptions": { "elk.port.side": "EAST" } },
    { "id": "P1:w", "layoutOptions": { "elk.port.side": "WEST" } }
    ]
    },
    {
    "id": "P2",
    "width": 100,
    "height": 50,
    "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
    "ports": [
    { "id": "P2:e", "layoutOptions": { "elk.port.side": "EAST" } },
    { "id": "P2:w", "layoutOptions": { "elk.port.side": "WEST" } }
    ]
    },
    {
    "id": "P3",
    "width": 100,
    "height": 50,
    "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
    "ports": [
    { "id": "P3:n", "layoutOptions": { "elk.port.side": "NORTH" } }
    ]
    },
    {
    "id": "P4",
    "width": 100,
    "height": 50,
    "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
    "ports": [
    { "id": "P4:n", "layoutOptions": { "elk.port.side": "NORTH" } }
    ]
    },
    {
    "id": "P5",
    "width": 100,
    "height": 50,
    "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
    "ports": [
    { "id": "P5:n", "layoutOptions": { "elk.port.side": "NORTH" } }
    ]
    },
    {
    "id": "R1",
    "width": 1,
    "height": 1,
    "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
    "ports": [
    { "id": "R1:n", "layoutOptions": { "elk.port.side": "NORTH" } },
    { "id": "R1:s", "layoutOptions": { "elk.port.side": "SOUTH" } }
    ]
    }
    ],
    "edges": [
    { "id": "E1", "sources": [ "P1:e" ], "targets": [ "R1:n" ] },
    { "id": "E2", "sources": [ "P2:w" ], "targets": [ "R1:n" ] },
    { "id": "E3", "sources": [ "R1:s" ], "targets": [ "P3:n" ] },
    { "id": "E4", "sources": [ "R1:s" ], "targets": [ "P4:n" ] },
    { "id": "E5", "sources": [ "R1:s" ], "targets": [ "P5:n" ] }
    ]
    }


    Expected result:



    Expected



    Actual result:



    Actual



    I'm implementing an app that draws arbitrary trees from user input. Therefore, the best solution should not rely on explicit port side specification.



    It it possible to fix this?



    P. S. Useful link to a visualizer to play around with the JSON: https://rtsys.informatik.uni-kiel.de/elklive/json.html










    share|improve this question

























      0












      0








      0







      I'm trying to use ElkJS to calculate the layout for a family tree and getting pretty decent results. However, I can't seem to get the T-style intersections working.



      Consider a family with 2 parents (P1, P2) and 3 children (P3, P4, P5). I added a fake node R1 with 1x1 size to which all other nodes are connected, and this is the ELK JSON I am using:



      {
      "id": "root",
      "layoutOptions": {
      "elk.algorithm": "layered",
      "elk.direction": "DOWN",
      "elk.edgeRouting": "ORTHOGONAL",
      "elk.layered.mergeEdges": true
      },
      "children": [
      {
      "id": "P1",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P1:e", "layoutOptions": { "elk.port.side": "EAST" } },
      { "id": "P1:w", "layoutOptions": { "elk.port.side": "WEST" } }
      ]
      },
      {
      "id": "P2",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P2:e", "layoutOptions": { "elk.port.side": "EAST" } },
      { "id": "P2:w", "layoutOptions": { "elk.port.side": "WEST" } }
      ]
      },
      {
      "id": "P3",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P3:n", "layoutOptions": { "elk.port.side": "NORTH" } }
      ]
      },
      {
      "id": "P4",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P4:n", "layoutOptions": { "elk.port.side": "NORTH" } }
      ]
      },
      {
      "id": "P5",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P5:n", "layoutOptions": { "elk.port.side": "NORTH" } }
      ]
      },
      {
      "id": "R1",
      "width": 1,
      "height": 1,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "R1:n", "layoutOptions": { "elk.port.side": "NORTH" } },
      { "id": "R1:s", "layoutOptions": { "elk.port.side": "SOUTH" } }
      ]
      }
      ],
      "edges": [
      { "id": "E1", "sources": [ "P1:e" ], "targets": [ "R1:n" ] },
      { "id": "E2", "sources": [ "P2:w" ], "targets": [ "R1:n" ] },
      { "id": "E3", "sources": [ "R1:s" ], "targets": [ "P3:n" ] },
      { "id": "E4", "sources": [ "R1:s" ], "targets": [ "P4:n" ] },
      { "id": "E5", "sources": [ "R1:s" ], "targets": [ "P5:n" ] }
      ]
      }


      Expected result:



      Expected



      Actual result:



      Actual



      I'm implementing an app that draws arbitrary trees from user input. Therefore, the best solution should not rely on explicit port side specification.



      It it possible to fix this?



      P. S. Useful link to a visualizer to play around with the JSON: https://rtsys.informatik.uni-kiel.de/elklive/json.html










      share|improve this question













      I'm trying to use ElkJS to calculate the layout for a family tree and getting pretty decent results. However, I can't seem to get the T-style intersections working.



      Consider a family with 2 parents (P1, P2) and 3 children (P3, P4, P5). I added a fake node R1 with 1x1 size to which all other nodes are connected, and this is the ELK JSON I am using:



      {
      "id": "root",
      "layoutOptions": {
      "elk.algorithm": "layered",
      "elk.direction": "DOWN",
      "elk.edgeRouting": "ORTHOGONAL",
      "elk.layered.mergeEdges": true
      },
      "children": [
      {
      "id": "P1",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P1:e", "layoutOptions": { "elk.port.side": "EAST" } },
      { "id": "P1:w", "layoutOptions": { "elk.port.side": "WEST" } }
      ]
      },
      {
      "id": "P2",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P2:e", "layoutOptions": { "elk.port.side": "EAST" } },
      { "id": "P2:w", "layoutOptions": { "elk.port.side": "WEST" } }
      ]
      },
      {
      "id": "P3",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P3:n", "layoutOptions": { "elk.port.side": "NORTH" } }
      ]
      },
      {
      "id": "P4",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P4:n", "layoutOptions": { "elk.port.side": "NORTH" } }
      ]
      },
      {
      "id": "P5",
      "width": 100,
      "height": 50,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "P5:n", "layoutOptions": { "elk.port.side": "NORTH" } }
      ]
      },
      {
      "id": "R1",
      "width": 1,
      "height": 1,
      "layoutOptions": { "elk.portConstraints": "FIXED_SIDE" },
      "ports": [
      { "id": "R1:n", "layoutOptions": { "elk.port.side": "NORTH" } },
      { "id": "R1:s", "layoutOptions": { "elk.port.side": "SOUTH" } }
      ]
      }
      ],
      "edges": [
      { "id": "E1", "sources": [ "P1:e" ], "targets": [ "R1:n" ] },
      { "id": "E2", "sources": [ "P2:w" ], "targets": [ "R1:n" ] },
      { "id": "E3", "sources": [ "R1:s" ], "targets": [ "P3:n" ] },
      { "id": "E4", "sources": [ "R1:s" ], "targets": [ "P4:n" ] },
      { "id": "E5", "sources": [ "R1:s" ], "targets": [ "P5:n" ] }
      ]
      }


      Expected result:



      Expected



      Actual result:



      Actual



      I'm implementing an app that draws arbitrary trees from user input. Therefore, the best solution should not rely on explicit port side specification.



      It it possible to fix this?



      P. S. Useful link to a visualizer to play around with the JSON: https://rtsys.informatik.uni-kiel.de/elklive/json.html







      javascript json eclipse layout graph






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 15:01









      Impworks

      1,05631437




      1,05631437





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264838%2ffamily-tree-layout-with-eclipse-elk%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264838%2ffamily-tree-layout-with-eclipse-elk%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine