A program to place nodes in the order they were entered

Here is a link to a gvpr program that will order nodes within a subgraph in the order they were entered :


Here is the README:

keepOrder.gvpr is a GVPR program that can be used to rearrange nodes within a Graphviz (DOT) graph.  Specifically, keepOrder.gvpr will make sure that all nodes within a subgraph will be displayed in the order that they were defined, as long as that subgraph has two attributes:
- rank must be set to any of the legal values defined by Graphviz (https://graphviz.org/docs/attrs/rank/)
- a new attribute, keepOrder must be set to true.  Note that if keepOrder is set at the Root graph-level, it will be inherited by all subgraphs.

below is a command line to run the keepOrder program:

dot -GkeepOrder=true -Gphase=2 myfile.gv | dot -Gphase="" | gvpr -cf keepOrder.gvpr | neato -Gsplines=true -n2 -Tpng  >out.png

 -Gphase=true can be on the command line or added to your input
 -GkeepOrder=true can be invoked within the input
   at the Root-level
   at the graph-level (not the cluster-level)

setting the phase attribute to 2 will cause dot to calculate all the
  ranks and the "order" of the nodes within each rank and annotate the file
  with that added info

[GVPR (https://www.graphviz.org/pdf/gvpr.1.pdf) is one of the Graphviz programs, just like DOT.]

And before & after example:

We could put this in contrib/ in the Graphviz repo if you think it would be useful?

Sounds good, but first let’s see if anybody uses & likes it and then see how many bugs need to be fixed.

FYI, it turns out that some of the time this scheme fails miserably. I made some assumptions that are not always true. Some (or all) of the issues are with nested subgraphs.
I am rewriting and hoping for more consistent results.