allofphysicsgraph / proofofconcept

Physics Derivation Graph: mathematical connections among equations
https://derivationmap.net/
Other
20 stars 6 forks source link

orientation of the graph in the web interface #26

Closed bhpayne closed 4 years ago

bhpayne commented 9 years ago

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.

bhpayne commented 4 years ago

this is related to #70

bhpayne commented 4 years ago

added a "linear index" float value to each step within a derivation; this could be leveraged for orientation in d3js

bhpayne commented 4 years ago

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

bhpayne commented 4 years ago

Example derivations where this is relevant:

bhpayne commented 4 years ago

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).

bhpayne commented 4 years ago

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

bhpayne commented 4 years ago

https://github.com/allofphysicsgraph/proofofconcept/tree/gh-pages/v7_pickle_web_interface/flask/from_freelancers/20200608_pinned_nodes_Evgeniy

3f5b75b1cf5bb0d00625b5c736e4e4c315d015dd