绘制带有端口的开放寻址形状

Drawing an open addressing shape with ports

尝试

Drawing graphs with dot 页。 16 他们绘制了一个单独的链接哈希 table。 “如果将记录的输入高度设置为较小的值,记录有时看起来会更好。”

nodesep=0.05;
node [width=.1, height=.1];

我想画一个开放寻址方案类型的图,它有一个节点和不同的端口来表示散列中的项目table;端口根据其封闭地址进行互连。

digraph {
    node [shape=plain, style=filled, fillcolor="Gray95"];
    edge [arrowsize=0.5];
    set [label=<<TABLE BORDER="0">
    <TR><TD BGCOLOR="Gray90" PORT="0">0x0</TD></TR>
    <TR><TD>0x1</TD></TR>
    <TR><TD BGCOLOR="Gray90" PORT="2">0x2</TD></TR>
    <TR><TD PORT="3">0x3</TD></TR>
    <TR><TD BGCOLOR="Gray90" PORT="4">0x4</TD></TR>
    <TR><TD PORT="5">0x5</TD></TR>
    <TR><TD BGCOLOR="Gray90" PORT="6">0x6</TD></TR>
    <TR><TD ALIGN="RIGHT" PORT="7">0x7</TD></TR>
    </TABLE>>];
    set:2:e -> set:3:e;
    set:3:e -> set:4:e;
    set:6:e -> set:7:e;
    set:0:e -> set:5:e;
}

结果如下图。它的循环太大了,并且与其他循环重叠,因此很难阅读。

尝试过

样条似乎强烈想要离开节点并在重新进入之前花费一定的时间。所以我认为这些可能有用。然而,那些看起来很有前途的方法似乎不适用于循环回相同形状的边缘。 Related question.

splines=none; // doesn't draw edges
splines=ortho; // draws concentric circles around node?
splines=curved; // draws one nice and gives up
splines=true; // default; draws a huge mess
splines=polyline; // angled, auto-edges no different
splines=false; // straight, auto-edges no different

我试过重叠,也许边缘要画得松一些?

overlap=true; // no effect
graph [overlap=true]; // no effect
mclimit=6; // no effect

也许如果我把尺寸调大或箭头调小它会得到更多 space?

node [fontsize=48]; // big, but no effect on the edges
edge [arrowsize=0.5]; // small, but otherwise no effect
edge [weight=3, minlen=3]; // again, there is only one shape

我交替尝试了罗盘“:c”(代表中心?)和“:_”(似乎与北方相似)和“:e”和“:w”,但没有成功。有没有什么东西可以让这些循环变小?

放弃单个节点并打包到多个节点。

digraph {
    rankdir=LR
    nodesep=".02"
    splines=true //line //false //curved

    node [shape=rect, style=filled, fillcolor="Gray95", height=0 width=0 margin=".01,.01"];
    edge [arrowsize=0.5 constraint=false];

    N0 [label="0x0"]
    N1 [label="0x1"]
    N2 [label="0x2"]
    N3 [label="0x3"]
    N4 [label="0x4"]
    N5 [label="0x5"]
    N6 [label="0x6"]
    N7 [label="0x7"]

    N2:e -> N3:e  
    N3:e -> N4:e  
    N6:e -> N7:e  
    N0:e -> N5:e  

    // following edges keep nodes in order
    edge [weight=200 style=invis]
    N0 -> N1 
    N1 -> N2
    N2 -> N3
    N3 -> N4
    N5 -> N6
    N6 -> N7
}

给予: