Reputation: 718
I am trying to create a graph that includes a cluster. When I create the cluster as its own graph, the layout makes sense, but when it is part of a cluster, two of the nodes switch places, increasing the total edge length.
Here is the code for the graph when it is not in a cluster.
digraph OrgChart {
edge[dir=none,color=black];
11->13;
12->13;
12->14;
13->15;
13->60;
13->61;
14->15;
{rank="same"; 11 12 14};
{rank="same"; 13 15};
}
This generates a graph that looks like this
When I make it part of a cluster with the following code
digraph OrgChart {
subgraph cluster{
edge[dir=none,color=black];
11->13;
12->13;
12->14;
13->15;
13->60;
13->61;
14->15;
{rank="same"; 11 12 14};
{rank="same"; 13 15};
}
}
which makes my graph look like this
I can't see any reason why 11 is between 12 and 14.
Why is this happening, and is there any way to fix it?
Upvotes: 0
Views: 164
Reputation: 1617
One unsatisfying answer is to add this:
11->12 [style=invis];
That should put the 11 12 14 nodes back into their desired order.
Upvotes: 1