# Graph with multiple ordered rows

Hello Everyone,

I want to create a undirected graph that consists of multiple rows of nodes and the dot engine shall not change the order of nodes in the rows. But there are one problems:
My generated file do not generate the expected figure.

Graph description:
* The graph consists of multiple rows. Each row contains multiple nodes.
* Each node is connected to its successor in the same row.
* The order of nodes in a row shall not change.
* Beside the adjacencies of neighboring nodes, there can exist arbitrary edges between nodes in the same row and different rows.

At the moment, my dot description uses the following approaches:
* A subgraph for each row.
* The rankdir of a row is LR. Using this parameter, I want to achieve that the nodes will not be reordered.
* In each subgraph, I define the nodes in the order as they should occur in the row.
* After all subgraphs are defined, I define all edges. Firstly, the edges for neighboring nodes, then the arbitrary edges.

The problem is that the nodes in a subgraph are positioned arbitrary. On the one hand, the nodes are not ordered correctly. On the other hand, graphviz do not draw the nodes of a subgraph in a row.

Does someone has an idea how I can solve the problem

Small example:
bigraph G {
subgraph clusterrow0 {
rankdir="LR";
node [...];
row00;
row01;
row02;
}
subgraph clusterrow1 {
rankdir="LR";
node [...];
row10;
row11;
row12;
row13;
}
edge[arrowhead=none];

row00.e -> row01.w;
row01.e -> row02.w;
row02.e -> row03.w;

row10.e -> row11.w;
row11.e -> row12.w;
row12.e -> row13.w;
row13.e -> row14.w;

row02.e -> row11.e;
row13.e -> row02.w;
...
}

### The rankdir attribute only

The rankdir attribute only works in the root graph, not in subgraphs. Rather, you want to specify rank=same for all nodes you want on the same rank. Also, the port syntax uses a colon, not a period, and is not really necessary within a rank. With these changes, you would have

digraph G {
{rank=same
row00;
row01;
row02;
row03;
}
{
rank=same
row10;
row11;
row12;
row13;
row14;
}

row00 -> row01;
row01 -> row02;
row02 -> row03;
row10 -> row11;
row11 -> row12;
row12 -> row13;
row13 -> row14;

row02:e -> row11:e;
row13:e -> row02:w;

}