Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layered strategy with 'collapsed' nodes and root node on the top left position #1016

Open
eugenehuangsg opened this issue Apr 5, 2024 · 11 comments
Labels
easy-win This won't take long. question Request for support in using ELK.

Comments

@eugenehuangsg
Copy link

Hi guys, I'm trying to design a 5 columns layout with the following constraints

  • There is always only one root node, and it should be positioned on the top-left
  • Some nodes can be collapsed (children nodes hidden from the layout), but their ordering relative to their siblings nodes should always be maintained

Expected outcome
image

So far, I'm able to get the expected layout when the graph is fully expanded. However, the graph starts to differ from my intended outcome whenever some nodes are collapsed. I suspect it is due to crossingMinimization options but I have no idea how to fix it. I would appreciate any guidance on this.

Current options:
{ 'elk.algorithm': 'layered', 'elk.direction': 'RIGHT', 'elk.spacing.nodeNode': 20, 'elk.spacing.edgeEdge': 10, 'elk.layered.spacing.nodeNodeBetweenLayers': 100, 'elk.layered.crossingMinimization.forceNodeModelOrder': true, 'elk.layered.nodePlacement.favorStraightEdges': true, 'elk.layered.layering.strategy': 'BRANDES_KOEPF', 'elk.layered.layered.nodePlacement.bk.fixedAlignment': 'LEFTUP' }

Unintended outcome when nodes are hidden.

  • The 'Mannings' node should ideally be fixed on the (0, 0) position
  • This happens when the "Food" node has been collapsed
image
@Eddykasp
Copy link
Contributor

Eddykasp commented Apr 5, 2024

Please recreate your problem in elklive so that we can help you.

@Eddykasp Eddykasp added the question Request for support in using ELK. label Apr 5, 2024
@soerendomroes
Copy link
Contributor

Does this solve your problem?

If any questions remain, please do not hesitate to ask.

@eugenehuangsg
Copy link
Author

eugenehuangsg commented Apr 9, 2024

Thank you for the insight. The NETWORK_SIMPLEX + priority.straightness is a possible approach. I'm trying to figure out how to programmatically allocate straightness priority to get the desired look and feel. Naively, the edges represent the weight among its sibling edges, but there is a relevance where the priority of other sections of the graph can still influence. Can you help weigh in on this?

https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KPqpd+pYi8FuUJbr0InSxzaaxRtSwKJuC0LpsitAqNykr9zW8rryo1b1sqvKrvWuqntfdaGKI3TLBGvz9vS46svQW9Zm4CAPHuYBPhge08BgS4O3NXyIHWEdzgYEtVXLAQGnBQdjXgNBQVVNAfBxvNDqm0nnPmt7bxujq6fWuaFvpwrFPUBafxu8TvOIn7dr+gKAcymaouROEmDLNAGI8aAyAECjepYtnNL576dooPbhcpwGxbQSCJZjRMhimrL9itfU9hAGAyEJA4vCm4ASvyUQ4GgAAaInYzzH8obuUC0CNPYBAgUccDpX1QzTCd1U1HxllC2nLo2pavxWp7U-KszlazwrLNz1WDMelOi6-V7S7T2CgA

@soerendomroes
Copy link
Contributor

If nodes have only connections to the right without skipping a layer and the order of nodes is fix and the order of edges corresponds to the order of nodes, the outgoing edge has to be straight and needs a straightness priority. Everything else does not need one, hence you can just set priority.straightness: 10 or something like this on every node if you can keep the edge and node order as it is.
Since you set crossingMinimization.strategy to NONE this is what you have to do anyway to avoid crossings.

@soerendomroes
Copy link
Contributor

My bad, you only need to take care that the edges are ordered as you want them to be. The nodes are ordered by the edges.

@eugenehuangsg
Copy link
Author

eugenehuangsg commented Apr 10, 2024

Somehow, setting crossMinimization.strategy to NONE does not take effect in the JSON format. Can you help me take a look?

JSON format
https://rtsys.informatik.uni-kiel.de/elklive/json.html?compressedContent=N4KABGCWAmBcYCIBOB7FAXBAacYA2AhgJ4oCu6A8gA7qQoB2AzvMGLhAOQF4DmKSkdAAsAth3gdCRAKZJp0DjgidpeANYA6aJDkBjWg3FgOAJQCSAcQASAFUXtjqzYyoFdkejw30U0aQDlfaSMAJgAGJWUOJw0XNw8veR5pAFFoZKMARgiHaPUNKVl5WNd3T28gwL8AIWl0AHdpaXoAGWJZRiywnNzCuWgKvwAFQl1pEWb0WPQkAnRpHiIjDn8UmwB1ChMAaQB9AGUzAFkhlpSADXsHAHprsBTBIVkwFAAzMGFpRmkwKlQqWS0L5gaAoYE+dAfAhqH7SV6vaT6MD1J70MBmMCkb4fJ4iG53STtfoaXSoRiMBJHDyQESQABeczo9Gms3mi2W-goq0UbGUYFuxj6xVJKHJlOptIZBmZr34Yyq0iOQTwFCQfiQRhmpGk+MFROFDAp6qVfhVatkLLmCyWEk5ABEUvtdgBBfx23YpO0WR0cXAAX0iuiEkDw0Dk9HgAG0HKwYPAEPRMthkTBhPAAMwRMBPSA8IToDNZwgAI1UzDAkeA8wAHgXjImOH6ALpgAMxqBwRD0ELJ+qpoSFrDZ6S5-OD-AEUt4cuVmt1jjdxsttt82OdhPp3v98c5vN1zNDktlqNV6S1iT0dNL1uRCBr+P0AAsW+gabAB+Ho-3Rcnx4rp-PetH2vP1cCbSIki+KN2zjRBpCTIdGDIJAxhnLskzAcCoSQZJ0DQhMe0wldlHvOCe0Q5DUKjdCEEwod0AIHC6nwy9aKbYi7w7eNpE3CjSBQqCKxoujsNwljnyIsCQD9IA

Text format
https://rtsys.informatik.uni-kiel.de/elklive/elkgraph.html?compressedContent=IYGw5g9gTglgLgCwLYC4AEJgE8CmUcAmAUDiANYB0BM+AxnDBAHboBKAkgOIASAKkQGcADsFowmYCkwgEcAORk50AJgAMgkWIkVCYHAFECe9AEZ1mXPgIVho8ZOmyFsgEI44Adxw4mAGWx4Aqaq6kSOOAAKmLQ4SD5wNnBQwHA4YFjocvq8AOoA8qwA0gD6AMrsALIRvvoAGkREAPSNGAFWFLRQEAIC9hXiMEgwAF4pjEyJyanpmXlZTS0WeIQdXT19A0OjDMwUAGbQMc44FYogeVCyUOhJAK44C62WK7TMvVensueXeJMpaRk0HI8gARfSlYoAQTkIOK+hBnHBDXCaCYJjQAG8iGgca0AEakNAAcjRRKIAF8wopUcpMdjcZgCSBiUxlGTKSimABmOm4-GEklc9lU2SogAsvIZwCZLLFwpIRhwqPRAFoAHw0hV6ZVodWorlapVo3UaphioA

@soerendomroes
Copy link
Contributor

You have to change the ELK version to 0.8.X or higher.

@eugenehuangsg
Copy link
Author

Hi @soerendomroes, is there a property I can set to force the position of the root node on the top left corner?

With straightness priority, the root node can potentially still move with the graph.

https://rtsys.informatik.uni-kiel.de/elklive/elkgraph.html?compressedContent=IYGw5g9gTglgLgCwLYC4AEJgE8CmUcAmAUDiANYB0BM+AxnDBAHboBKAkgOIASAKkQGcADsFowmYCkwgEcAORk50AJgAMgkWIkVCYHAFECe9AEZ1mXPgIVho8ZOmyFsgEI44Adxw4mAGWx4Aqaq6kQA9GEYAVYUtFAQAgL2ALLiMEgwAF7ADMwUAGbQtPKKyYogAPJQslDocFAArjhEFniEsfGJKWkZ2blMNvU5OGBY6HIVcvpoEWjs+WhYEA1QaGBQwEIIaDACaMBo9d6Ly2hI2PsAbhAwBGhxCUkSZz1ZOYxMaBTf4ZHr3gQsABlDzwWgIChwLBCJRoCoAMXhM0i3woOyYAjgOGAdwgC0QODQhSgxTQjkJ0BqaExDXy+SIRHJAAVMMUkD44IMNljRuN9LwAOoVVgAaQA+kD2Mkmb59AANBmzAQ4ETcnAAYWYTBw9EImqQQmYHKCRNAyuRaF4CEJiHwhOVquGaAARhAAB44PbAfCHHUIJgwWigEBYakq71O9abBACNEC+DbRC7NBeIlFG3WpCHCAuwmquBoPGHa3U4DsqJLBpwQThtWapja3UEfWG7VMOAm-Jm5qMxT3EwmNAAbyIaDHUWdpDQACJaAPp0QAL692T3ZSDkfjidT2frhfL8lr5Qrwm0ZQAZmHo-HmEnIBnZ-P+5Pa4ALFet7ed2fX8-D2eAFYXzPAA2YDlAAdnAgAOYDzw3a8xy-e9Z3gv8+1oc9j3-c9L03G9gDvB9cPQ1dMNfOCgJwsCcIgj8CKI1CINI09z1gnCAE56KQwjv3PDiWPuc8xTMbjtxQzCRNUQTJIHMTkOIkSTBk18EM-XiJNUlTsIw19z2A18KP-V8qN0mjdKg340AAVSYWgICQdl2zTVY50HOAcyQCBLhtHMCWzIQAFoQBwfIC0NJJ+is3RTzkwKAD41wQ2YtyEWBoHgLAuWAGAwAQOBtUSdAoNmZcYv7QcEqPMS0sYWAoWy3L8sKk11DKoxYsqxKfxIDqKrQKrAN6vR+sG5QwPKtyBu6yDhs66a11gya4pm-S5qShbMLUgjLHaWqMoazENiagrPRNDil3Ws8uqE49JuUZRNtw+Toj29L6qyo6cry06irQCj2pGs9HsG88KPukHuvPICIaeia+sfJ66PwnjdusfaPsan6WvQS9Zm4CAPHuYBPhgNAahgHzi2TNKICjRz3iDEAQ2pBpwWLHIdgLUFmbQHwBBWe0hhOvmOsu+7L1BpaEYvJ6Lolp6pKu5R31BpSXrRigMcyrHmrO4qLQqJgWbojxoDIARLqu57BtUjW2nR96da+k6cbQECLStIXjuxs79iEGFvT2EAYDIQkDi8E7gBGrt6GgAAaFNrR9d8SbuAC0AQYA9gEBzCVC-IdQ7F0qzJCACx8ZY8vFhGbe6187tryX6-0ya6-uQzrebjuYabzbX3hoH29oV8IKAA

@soerendomroes
Copy link
Contributor

soerendomroes commented Apr 18, 2024

No, sadly not.

@soerendomroes soerendomroes added the easy-win This won't take long. label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy-win This won't take long. question Request for support in using ELK.
Projects
None yet
Development

No branches or pull requests

3 participants