I incrementally worked with Claude to whip up some instrumentation output (gated by DEBUG) and a script to plot what’s happening in the “path” planning process. See the attached.
I’m working on getting visualization of some more stages of the layout algorithm, since the constraint on with V10->V7 is happening earlier on.
Obviously this will only be useful for debugging small graphs, but seems generally useful. Any chance there is an existing place to put useful debugging scripts and the like?
I believe the layout algorithm can be implemented as a general step-by-step iterative process, where each intermediate step can be directly exported as dot or xdot. This would be very helpful for visualizing the entire layout process and can be achieved.
Yes, you can easily “stop action” dot as it progresses through the phases.
dot -Gphase=1 myfile.gv will show the result of the ranking algorithm (1st pass through network simplex). Note that a temporary attribute named rank will be set to each node’s rank.
dot -Gphase=2 myfile.gv will add the ordering assigned by the mincross algorithm. Each node will have a temporary order attribute added.
dot -Gphase=3 myfile.gv will assign the final pos attribute to every node.
dot -Gphase=4 myfile.gv will assign pos values to every edge.
Here is issue 1213 stepped through the phases with some artistic licence (nodes positioned with only 0 or 1 coordinates)
p.s. if you use phase on the command line, know that it is then inserted into the source (dot format) and must be edited out or commented out if you want to use the resulting output as input back into dot as I did for the images above. (sorry, a very convoluted sentence)
Can you please describe how exactly you generated those?
I notice that when I use -Tsvg I can generate -Gphase=3 and -Gphase=4 outputs which are usefully rendered as .svg (according to the layout algorithms I’m debugging), but -Gphase=1 and -Gphase=2 don’t seem to yield useful .svg files. (They have viewbox="0.00 0.00 8.00 8.00" and a bunch of circles with cx="0" cy="0" which doesn’t seem very promising. An SVG viewer shows them as 8x8 pixels with maybe a letter V or some curves.)
Outputting .gv files yield dot files which beg the question of how they should be displayed. Whichever version of dot I use to lay them out yields its favorite layout (after I remove the phase= line from the file).
So: -Gphase=3 and -Gphase=4 are useful with -Tsvg. I don’t see how others are useful.
By the way, although the phase looks interesting, what I actually meant earlier was to display the step-by-step iteration process of each node reaching its final position during Phase 2 to 3.