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

Node/Edge ordering issue #189

Open
alirussell opened this issue Sep 29, 2015 · 6 comments
Open

Node/Edge ordering issue #189

alirussell opened this issue Sep 29, 2015 · 6 comments

Comments

@alirussell
Copy link
Contributor

Im having an issue with keeping a consistent ordering of nodes/edges in my graph. The images below show how an extra node in the graph seems to completely change the ordering.

screen shot 2015-09-29 at 19 20 34

screen shot 2015-09-29 at 19 20 43

I am making sure that i use the same order for edges and nodes in each render, and I'm checking the init-order method and it seems to be ranking them in the correct order there, but somewhere it seems to be changing and i can't figure out why. i have checked out a few of the discussions about clustering and other order related issues, but can't see any solution.

I also didn't seem to get this with an older version, but i can't remember which version it was.

Any help would be much appreciated

@tzookb
Copy link

tzookb commented Feb 4, 2018

Hey @alirussell

its been 3 years :/

did you manage to resolve this?

@angelpinheiro
Copy link

4 years, something new?

@282159468
Copy link

something new?

@dominiczy
Copy link

Disabling the optimal order heuristics fixes this. To do that, fork the repo and add a return; here.
Alternatively just import from a forked repo where this is already fixed, like mine traverse-dagre (however this is used for my own project Traverse, so use at your own risk)

@turbaszek
Copy link

Any chance of getting it fixed?

@x-cold
Copy link

x-cold commented Sep 25, 2021

I have just solved this problem by a simple way via skipping the Post-conditions of ordering process.

More specifically, I only add return; line for node_moduels/dagre/lib/order/index.js L36.

  • Lock the version = 0.8.5
"dagre": "0.8.5"
  • Install patch-package
npm i -D patch-package
  • Create postinstall npm script
{
  "script": {
    "postinstall": "patch-package"
  }
}
  • Create directory for patches and the specific path file
mkdir patches
touch patches/dagre+0.8.5.patch
  • Edit dagre+0.8.5.patch with the following content
diff --git a/node_modules/dagre/lib/order/index.js b/node_modules/dagre/lib/order/index.js
index 4ac2d9f..6db0b92 100644
--- a/node_modules/dagre/lib/order/index.js
+++ b/node_modules/dagre/lib/order/index.js
@@ -33,6 +33,7 @@ function order(g) {
 
   var layering = initOrder(g);
   assignOrder(g, layering);
+  return;
 
   var bestCC = Number.POSITIVE_INFINITY,
     best;

  • Run npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants