I am having issues on keeping Marge near Homer and Herb near Lucia to avoid this above-line (check the image). Basicly i need to keep married couples together and push aside brothers to fix the lines from mixing. Here is my source code:
digraph G {
edge [dir=none];
node [shape=box];
graph [splines=ortho];
"Abraham" [shape=box, regular=0, color="blue", style="filled" fillcolor="lightblue"] ;
"Mona" [shape=box, regular=0, color="red", style="filled" fillcolor="pink"] ;
a1 [shape=diamond,label="",height=0.25,width=0.25];
{rank=same; Abraham -> a1 -> Mona};
"Herb" [shape=box, regular=0, color="blue", style="filled" fillcolor="lightblue"] ;
"Lucia" [shape=box, regular=0, color="red", style="filled"fontcolor="", fillcolor="pink"] ;
"Homer" [shape=box, regular=0, color="blue",fontcolor="blue", style="bold, filled" fillcolor="lightblue"] ;
"Marge" [shape=box, regular=0, color="red", style="bold,filled"fontcolor="red", fillcolor="pink"] ;
p2 [shape=diamond,label="",style="",height=0.25,width=0.25];
{rank=same; Herb -> p2 -> Lucia };
{rank=same; Herb; Homer}
b1 [shape=circle,label="",height=0.01,width=0.01];
b2 [shape=circle,label="",height=0.01,width=0.01];
b3 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; b1 -> b2 -> b3};
a1 -> b2;
b1 -> Herb;
b3 -> Homer;
"Gendry" [shape=box, regular=0, color="blue", style="filled" fillcolor="lightblue"] ;
Herb -> Gendry;
p2 -> c2;
c1 -> Bob;
c3-> John;
{rank=same; c1 -> c2 -> c3}
c1 [shape=circle,label="",height=0.01,width=0.01];
"Bob" [shape=box, regular=0, color="blue", style="filled" fillcolor="lightblue"] ;
c2 [shape=circle,label="",height=0.01,width=0.01];
"John" [shape=box, regular=0, color="blue", style="filled" fillcolor="lightblue"] ;
c3 [shape=circle,label="",height=0.01,width=0.01];
p1 [shape=diamond,label="",style="bold",height=0.25,width=0.25];
{rank=same; Homer -> p1 -> Marge};
{rank=same; Bob; John; Gendry}
}
What you want should be straight-forward using dot, but as you found, it is impressively difficult. Two techniques that should get you there are adding weight attributes to edges to keep nodes close to each other and/or using clusters to explicitly group the couples close. Using clusters does keep the couples together, but it resulted in ugly edges. Adding weights helped to get the invisible nodes placed "correctly" and resulted in nicer-looking edges.
Produces this (not great, but better):