我非常接近能够生成看起来不太可怕的家谱,但我遇到了以下问题。
//file: tree.dot
digraph {
edge [dir=none];
node [
fillcolor="black",fixedsize=true,shape=box,
style="rounded,filled",width=2.0
];
splines=ortho;
// GEN -01
{
rank=same; rankdir=LR;
"Grandfather" [regular=0];
m0002 [
label="",shape=diamond,regular=0,height=0.25,
width=0.25,style="filled",
];
"Grandmother" [regular=0];
{
rank=same; rankdir=LR;
"Grandfather" -> m0002 -> "Grandmother";
}
}
m0002 -> c0001;
// GEN 00
{
rank=same; rankdir=LR;
c0000 [
label="",shape=circle, regular=0, height=0.05,
width=0.05,style="filled"
];
c0001 [
label="",shape=circle, regular=0, height=0.05,
width=0.05,style="filled"
];
c0002 [
label="",shape=circle, regular=0, height=0.05,
width=0.05, style="filled"
];
{
rank=same; rankdir=LR;
c0000 -> c0001 -> c0002;
}
}
{
rank=same; rankdir=LR;
"Son 1" [regular=0];
"Daughter 1" [regular=0];
"Son 2" [regular=0];
m0000 [
label="",shape=diamond,regular=0,height=0.25,
width=0.25,style="filled"
];
"Other Daughter 1" [regular=0];
"Other Son 1" [regular=0];
"Other Other Son 1" [regular=0];
m0001 [
label="",shape=diamond,regular=0,height=0.25,
width=0.25, style="filled"
];
"Other Daughter 2" [regular=0];
{
rank=same; rankdir=LR;
"Son 2" -> m0000 -> "Other Daughter 1";
"Other Other Son 1" -> m0001 -> "Other Daughter 2";
}
}
c0000 -> "Son 1";
c0001 -> "Daughter 1";
c0002 -> "Son 2";
}
以上代码生成this image,其边缘为 Son 1 和 Son 2 ,看起来很奇怪。我用dot -Tpng tree.dot
运行它。当我运行相同的代码here时,我会得到expected output。
我做错了吗?如何在不使用Web界面的情况下获得预期的输出(我可能有数百个节点)?换句话说,如何让 c0000 和 c0002 与 Son 1 和 Son 2 ,分别使它们的边缘连接到节点的中心顶部?
提前感谢您的帮助!