-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Make elk not force node model order, but strongly consider it instead #6849
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
Make elk not force node model order, but strongly consider it instead #6849
Conversation
This improves the ordering in models with crossings that can be resolved by reordering nodes. It keeps the node order to still avoid mermaid-js#6647 which cause this regression to be introduced. [See this example on the ELK Editor.](https://rtsys.informatik.uni-kiel.de/elklive/elkgraph.html?compressedContent=IYGw5g9gTglgLgCwLYC4AEJgE8CmUcAmAUAPQloDGUEAzjTAHZgCyjMSMAXsHDBAwDoAZtAo4AchAI5mUnCADyUaVHRwoAVxxEK-eitnTFyvAJrqeOMFnTiFAEQCiAZQD6AQXH3Xj+wHEXIlJyABUEGBo0CLQAI2ACNAB3BBwGNA16JjQRKDFJaUN5JRU1TRwBIIY5NAYABjQAbwxgGPk0ACJa9rQAXyIq6Rr3RubWkA7gbr6BnBqARhHMMY65qf7qhgAmRZa29s21mZqADR3l9uPDjYAhM72Yq8GGa+GmpfuBVd71p+vbt9243aMQEB2+R2epwB5wAWmsiIQwLM6mgALQAPiGaARBCRNXqGPmQURyIWhK2xNxyOG5OulLxzzRmOe7hxDNutLpbORLyZNWux25-I5zMFQq2fIYYuCaGuGjgaEQ0RoCAgGhACVaaAA1jgAA4KxCzGjAJDlGUASQV+GgKkicAgaAAzAAaNAAFjdczd2xgQkoehgBjkxhUZgscCsNjQdnEjjQAAppEJgOq4ABKSrVABu9Whe1zj1m2YW+aBJaLaGz2zLHWrlezTru5adDfdzbr7vhJKrBMxJaFub51cHfarTtHw-dRCAA)
🦋 Changeset detectedLatest commit: 2260948 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6849 +/- ##
=======================================
Coverage 3.70% 3.70%
=======================================
Files 455 454 -1
Lines 44901 44877 -24
Branches 709 709
=======================================
Hits 1664 1664
+ Misses 43237 43213 -24
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Also fixes the problems in #4458 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like how the nodes are arranged without crossing edges.
@knsv maybe we should make the forced ordering a config param as suggested, and make this the default?
The ordering change was added recently to address the issue Martin raised IIRC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good adjustment. This makes it better. I believe that it should be a configuration option with this setting as default.
Let's merge this, I will make the config change in a separate PR.
91d7229
@anderium, Thank you for the contribution! |
📑 Summary
This improves the ordering in models with crossings that can be resolved by reordering nodes. It keeps the node order to still avoid #6647, the initial fix of which caused this regression to be introduced. Perhaps the
forceNodeModelOrder
config should be exposed in the mermaid-elk API?See this example on the ELK Editor. Before and after images below.
I believe Github does not have elk layout enabled, so the chart below does not show the problem, but I've added the mermaid code for convenience.
📏 Design Decisions
Removed the
forceNodeModelOrder
, i.e. set it to false, to allow elk to choose optimal node order, and setconsiderModelOrder.strategy': 'NODES_AND_EDGES'
instead to guide order where it does not matter. See the docs and the section on crossing minimization in this blog post.📋 Tasks
Added e2e test and changeset.