Closed bhpayne closed 4 years ago
this is related to #70
added a "linear index" float value to each step within a derivation; this could be leveraged for orientation in d3js
In graphviz, pin node that has the lowest "linear index" to the top of the graph. If necessary, pin the highest "linear index" to the bottom of the graph.
https://stackoverflow.com/questions/8309201/graphviz-fixed-node-positions
https://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pin
https://observablehq.com/@magjac/placing-graphviz-nodes-in-fixed-positions
Example derivations where this is relevant:
In a large graph I added a single pos
to one node
1337934 [shape=invtrapezium, color=blue, label="",image="/home/appuser/app/static/declareinitialexpr.png",labelloc=b, pos="0,0!"];
and then ran
neato -Tpng graphviz.dot -o newgraph.png
That didn't work, probably because neato
wasn't looking for positions. I also tried an explicit pin,
1337934 [shape=invtrapezium, color=blue, label="",image="/home/appuser/app/static/declareinitialexpr.png",labelloc=b, pos="0,0!", pin=true];
but that didn't alter the layout. When I told neato to look for positions, I get an error because only one has pos
neato -n -Tpng graphviz.dot -o newgraph.png
Error: node 5427510 in graph physicsDerivation has no position as required by the -n flag
Then I added pos="0,0"
to all the other nodes. The neato -n
worked but the graph was unreadable (and the one static 0,0!
didn't seem to take effect).
I can get node positions to change if I use non-negative coordinate values, e.g., pos="2,1!", pin=true
I pinned the first and last inference rules but the layout was not improved
3f5b75b1cf5bb0d00625b5c736e4e4c315d015dd
intuitive flow is from top-to-bottom or left-to-right. Current graph is spring-force model with gravity for centering.
To do: starting point should be at top or left, final expressions should be bottom or right.