如何用 graphviz 制作这张图?
How to make this graph with graphviz?
我想使用 graphviz 生成这样的图表:
这样的图怎么写?
到目前为止,我已经尝试过:
digraph
{
rankdir = "LR";
subgraph cluster0
{
rank = same { indices array }
color = white;
indices [ shape = record, color = white, label = "{ 1 | 2 | 3 | 4 | 5 | 6 }" ];
array [ shape = record, label = "{ 1 | 2 | 4 | 5 | 6 | 3 }" ];
}
nodesep = .0;
}
生产:
没有内置的方法来更改单个记录的样式,或者轻松地 link 边缘到它们。为此,您需要切换到使用类似 HTML 的语法:
digraph records {
edge [color="gray" arrowhead="vee"]
node1 [
label = <<table border="0" cellspacing="0">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>6</td>
</tr>
<tr>
<td port="p1" width="20" border="1" bgcolor="white">1</td>
<td port="p2" width="20" border="1" bgcolor="gray">2</td>
<td port="p3" width="20" border="1" bgcolor="gray">4</td>
<td port="p4" width="20" border="1" bgcolor="gray">5</td>
<td port="p5" width="20" border="1" bgcolor="gray">6</td>
<td port="p6" width="20" border="1" bgcolor="black"><font color="white">3</font></td>
</tr>
</table>>
]
# :s = attach arrow at the south compass point
node1:p3:s -> node1:p4:s
node1:p4:s -> node1:p5:s
node1:p5:s -> node1:p6:s
node1:p6:s -> node1:p3:s [color="black"]
}
您需要多花点功夫,让边的长度合适,不重叠等等。
我想使用 graphviz 生成这样的图表:
这样的图怎么写?
到目前为止,我已经尝试过:
digraph
{
rankdir = "LR";
subgraph cluster0
{
rank = same { indices array }
color = white;
indices [ shape = record, color = white, label = "{ 1 | 2 | 3 | 4 | 5 | 6 }" ];
array [ shape = record, label = "{ 1 | 2 | 4 | 5 | 6 | 3 }" ];
}
nodesep = .0;
}
生产:
没有内置的方法来更改单个记录的样式,或者轻松地 link 边缘到它们。为此,您需要切换到使用类似 HTML 的语法:
digraph records {
edge [color="gray" arrowhead="vee"]
node1 [
label = <<table border="0" cellspacing="0">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>6</td>
</tr>
<tr>
<td port="p1" width="20" border="1" bgcolor="white">1</td>
<td port="p2" width="20" border="1" bgcolor="gray">2</td>
<td port="p3" width="20" border="1" bgcolor="gray">4</td>
<td port="p4" width="20" border="1" bgcolor="gray">5</td>
<td port="p5" width="20" border="1" bgcolor="gray">6</td>
<td port="p6" width="20" border="1" bgcolor="black"><font color="white">3</font></td>
</tr>
</table>>
]
# :s = attach arrow at the south compass point
node1:p3:s -> node1:p4:s
node1:p4:s -> node1:p5:s
node1:p5:s -> node1:p6:s
node1:p6:s -> node1:p3:s [color="black"]
}
您需要多花点功夫,让边的长度合适,不重叠等等。