在此图表中:
使用Graphviz / Dot渲染,红色边缘连接两个节点,而其他边缘连接节点内的端口。节点具有HTML
个标签,输入和输出的TD
具有PORT
属性。
有没有办法让Dot将红色节点“移开”,即向左或向右移动,可能是弯曲的,这样它就不会越过黑色边缘。
自动生成的图表可以包含两个以上的节点,不一定都是垂直对齐的。
此图表的源代码:
digraph G {
rankdir=TB
src [shape=plaintext label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="in1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in1</FONT></TD><TD WIDTH="10"></TD><TD PORT="in2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in2</FONT></TD><TD WIDTH="10"></TD><TD PORT="in3" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in3</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR><TR><TD BORDER="1" STYLE="ROUNDED" CELLPADDING="4" COLOR="black">A<BR/><FONT POINT-SIZE="10">node</FONT></TD></TR><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="out1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out1</FONT></TD><TD WIDTH="10"></TD><TD PORT="out2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out2</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR></TABLE>>];
rankdir=TB
snk [shape=plaintext label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="in1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in1</FONT></TD><TD WIDTH="10"></TD><TD PORT="in2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in2</FONT></TD><TD WIDTH="10"></TD><TD PORT="in3" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in3</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR><TR><TD BORDER="1" STYLE="ROUNDED" CELLPADDING="4" COLOR="black">B<BR/><FONT POINT-SIZE="10">node</FONT></TD></TR><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="out1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out1</FONT></TD><TD WIDTH="10"></TD><TD PORT="out2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out2</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR></TABLE>>];
snk -> src [style="", arrowhead="vee", color=red, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];
src:out1 -> snk:in1 [style="", arrowhead="normal", color=black, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];
src:out1 -> snk:in2 [style="", arrowhead="normal", color=black, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];
src:out2 -> snk:in3 [style="", arrowhead="normal", color=black, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];
{rank=source; src}
{rank=sink; snk}
}