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
Replace the PERT Chart layour alorithm #8
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
=======================================
Coverage 91.78% 91.78%
=======================================
Files 5 5
Lines 73 73
=======================================
Hits 67 67
Misses 6 6 Continue to review full report at Codecov.
|
Can probably relax the upper and lower bound constraints a bunch more, |
This is basically a simplified version of Sugiyama layered graph drawing. |
I've followed the discussion on Gitter and was curious how tools such as From what I've seen do far, it seems that the implementation is often done in multiple steps. These steps are presented as optimization problems, but then actually solved with heuristics. In particular, I found the steps:
It seems to be that you're trying to do 3 and 4 in one go. If the order is given, I guess that 4) can actually be done well with a (convex) QP. But for 3) it might be better to deal with the discrete structure directly and formulate a MIP, or use some iterative improvement heuristic. Further, with edges that span multiple layers, there's the trick of introducing artificial nodes on each layer to represent the edge going through. With this modification, the edge crossing only needs to consider adjacent layers. |
yeah, pretty much my thoughts also. Then can implement multiple algorithms there. |
af94643
to
78b15a1
Compare
move vertial constraint to be directly on variables and relax it a bit tried some other options commented to say they don't work
78b15a1
to
36c843a
Compare
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
==========================================
- Coverage 95.94% 93.23% -2.72%
==========================================
Files 6 6
Lines 148 133 -15
==========================================
- Hits 142 124 -18
- Misses 6 9 +3
Continue to review full report at Codecov.
|
I am not happy with out the existing graph layout algorithms handle PERT charts.
Or Directed Acyclic Graphs more generally.
This is what the current (spring) layout comes up with:
Here is a quick plot of the output of the new algorithm in this PR
I haven't hooked it up properly to plotting but here is the new layout using this algorithm,
but here is a quick plot of the output.
It is basically the same as what I have drawn by hand for this chart (
c
andd
are swapped though, I wonder if I can and a small term to favour having earlier nodes at the top).The algorithm is the formulate the layout as a QP, which gets solved with JuMP / Ipopt.
Which is pretty fast.
The constraints are:
(* method allows multiple root nodes because it works for all DAG but PERT charts just have 1)