Graphviz Issue Tracker - graphviz
View Issue Details
0002535graphvizOutput Generationpublic2015-03-28 18:142015-03-30 13:54
cleversokol 
erg 
normalnormalalways
resolvednot fixable 
MacOS X10.10.2
2.28
0002535: Planar graph is drawn with edges crossed
Trying to draw
graph three
{
    subgraph A {
        node1; node2;
        {rank=same node1, node2}
    }
    subgraph B {
        node4; node3;
    }
    node1 -- node2 -- node3 -- node4 -- node1;
    node1 -- node3;
}
and it was quite good. But I wanted it to be square-like(4th node to be some way higher):
node1 -- node2
| \ |
| \ |
| \ |
node4 -- node3
so, I added one string:
graph four
{
    subgraph A {
        node1; node2;
        {rank=same node1, node2}
    }
    subgraph B {
        node4; node3;
        {rank=same node4, node3}
    }
    node1 -- node2 -- node3 -- node4 -- node1;
    node1 -- node3;
}
and I got square-like on four.png
No tags attached.
png four.png (8,809) 2015-03-28 18:14
http://www.graphviz.org/mantisbt/file_download.php?file_id=447&type=bug
png three.png (12,298) 2015-03-28 18:15
http://www.graphviz.org/mantisbt/file_download.php?file_id=448&type=bug
Issue History
2015-03-28 18:14cleversokolNew Issue
2015-03-28 18:14cleversokolFile Added: four.png
2015-03-28 18:15cleversokolFile Added: three.png
2015-03-30 13:54ergNote Added: 0000917
2015-03-30 13:54ergAssigned To => erg
2015-03-30 13:54ergStatusnew => resolved
2015-03-30 13:54ergResolutionopen => not fixable

Notes
(0000917)
erg   
2015-03-30 13:54   
Note that the dot layout does not guarantee you'll get a planar layout even if the graph is planar. One reason is that if there is an edge a -- b and nodes a and b are on the same rank, it will try to keep a to the left of b. In your case, your input specifies node1 to the left of node2 and node3 to the left of node4, so dot can remove the crossing. You can either use node4 -- node3, or remove the constraint:

graph four
{
  {rank=same node1, node2}
  {rank=same node4, node3}
  node1 -- node2 -- node3
  node3 -- node4 [constraint=false]
  node4 -- node1;
  node1 -- node3;
}