Create two lines of nodes

Hello together

I wanted to draw a workflow diagramm from left to right.
because the diagram becomes very wide I'd like to have some nodes on a second line.
Unfortunately I wasn't abgle to manage it after hours.

I got some kind of close using two subgraphs and the following pipeline command:
ccomps -Cx "D:\BA\Praesentation\" | dot | gvpack -array_1 | neato -n2 -T png > "D:\BA\Praesentation\Timeflow.png"


digraph {
 graph [dpi=300]
 subgraph A {
  n1 [label="Einarbeitung\n(LaunchPad, TivaWare Libraries)" shape=box]
  n2 [label="Kommunikation mit PC\n(Service-Applikation)", shape=box]
   n3_1 [label="Hardware-Design\n(BoosterPack)", shape=box]
   n3_2 [label="Kommunikation / Transfer über CAN\n(Development Boards)", shape=box]
   n3_3 [label="Konzeption: Bootloader / Bootload-Vorgang\n(Ablauf, Kommunikation / Protokoll, Befehle)", shape=box]
  n4 [label="Produktion / Bestückung\n(BoosterPacks)", shape=box]

 subgraph B {
  n5 [label="Implementation: Kommunikation, Befehle, Datentransfer etc.\n(Bootloader & Service-Applikation)", shape=box]
  n6 [label="Kommunikation / Transfer über CAN\n(BoosterPack)", shape=box]
  n7 [label="Error-Handling", shape=box]
 n4:e->n5:w [constraint=false, weight=1000]

Thank you for any help!

If I just run dot on your

If I just run dot on your graph, I end up with the graph on two lines. Isn't that what you want? How do you want it fixed?

Hello Yes it comes


Yes it comes close...
But the second line is even more left than the first line (unnecessary) and the edge between the line has a strange routing:

The routing should be from the right of the first line going down and between the two lines to the left and not crossing the incoming edges of the node.


Concerning the first problem,

Concerning the first problem, with constraint=false on the one edge, you basically have a disconnected graph, so dot places the source nodes of each part on the same rank. To fix this, replace the n4:e->n5:w edge with

  n5:w -> n4:e [dir=back]

As for the second problem, the edge routing is ugly but it is correct. Unfortunately, the edge routing code for edges with ports is fairly complex but not as sophisticated as it could be. As you are willing to use pipelines, try the following workaround:

  dot | gvpr -c 'E[$.dir=="back"]{$.pos=""}' | neato -n2 -Tpng -Gsplines > Timeflow.png

The gvpr script removes the drawing of the n4->n5 edge, which is then re-added by neato. Neato's edge routing is very simple but in this case, that works in your favor.

Hello How can a routing be


How can a routing be correct if it could go straight away without crossing anything but goes another (longer) way with crossing something?
In another graph I had an edge which could go from the bottom straight on the right side up to another node without any problems.
But it was routed on the left side where are other nodes and edges which it couldn't pass without many crossings and it made crazy curves through the edges/nodes.
OK there was another problem too, since I didn't know then, that the declaration order of nodes matters.

"As you are willing to use pipelines..."
I found this in another post by you... ;)

But the following doesn't work here:

>dot I:\BA\Praesentation\ | gvpr -c 'E[$.dir=="back"]{$.pos=""}' | neato -n2 -Tpng -Gsplines > I:\BA\Praesentation\Timeflow.png

-> gvpr: expected keyword BEGIN/END/N/E...; found ''', line 1


> How can a routing be

> How can a routing be correct if it could go straight away without crossing anything but goes another (longer) way with crossing something?

It depends on your definition of "correct". We don't guarantee the minimal number of crossings, just that the edge goes from and to where you specify, and that it avoids crossing other nodes. And the drawing is unambiguous as to the head and tail of the edge. Yes, it would be aesthetically more pleasing to avoid the crossings, but that would take a fair amount of programming effort. Similarly, in the general crossing reduction phase, we use heuristics which do a reasonable job, but there is no guarantee that an upward planar graph will be drawn without crossings.

As for the second point, I forgot that you would using a dos shell. You will either need to appropriately quote the string


so that the shell gives the string unchanged to gvpr, or put it into a file, say x.g, and run

dot | gvpr -c -fx.gv | neato -n2 -Tpng -Gsplines > out.png

Thank you!It's not bad like

Thank you!

It's not bad like that but now the image is extended to the right...
Is there a solution to fix this and get the second line some kind of centered or left justified under the first line?

or possibly I should just draw the connection in PowerPoint itself ;)

p.s. neato loves to crash when using it like that ;) it more often crashes than not (win 8.1 x64)...

Recent comments