Graphviz:两个子图中的节点 [英] Graphviz: Node in two subgraph
问题描述
我有一个具有不同聚类的图.基本上我想配对不同的节点,即以某种方式表明不同的节点具有特殊的关系.因此,我决定使用群集,以使节点显示为矩形.
问题在于,一个节点可能与多个节点相关,即它可能位于不同的群集中.但是我还没有找到在两个集群中插入节点的方法.
我有以下代码:
I have a graph with different clusters. Basically I want to pair different nodes i.e. show somehow that different nodes have special relationship. So I decided to use clusters so that the nodes appear in a rectangle.
The problem is that a node can be in relationship with more than one node i.e. it could be in different clusters. But I have not found out a way to insert a node in two clusters.
I have the following code:
digraph G {rankdir="LR";
node [fontname = "font-awesome"];
subgraph cluster3 {
4 -> 5 [id="4t5",color="#717070",arrowsize=.5];
8 -> 4[id="8t4",color="#717070",arrowsize=.5];
subgraph cluster31{
4 [id=4,fillcolor="#F5BDA2", shape=rect;label=<<TABLE BORDER="0">
<TR><TD>1:12</TD></TR>
</TABLE>>, style="filled",fontsize=6,fixedsize=true,width=0.5,height=0.2,shape=Mrecord];
5 [id=5,fillcolor="#F5BDA2", shape=ellipse;label=<<TABLE BORDER="0">
<TR><TD ID="32e" HREF=" ">1:13</TD></TR>
</TABLE>>, style="filled"];
}
subgraph cluster32{
8 [id=8,fillcolor="#F5BDA2", shape=rect;label=<<TABLE BORDER="0">
<TR><TD>1:19</TD></TR>
</TABLE>>, style="filled",shape=box];
5 [id=5,fillcolor="#F5BDA2", shape=ellipse;label=<<TABLE BORDER="0">
<TR><TD ID="32e" HREF=" ">1:13</TD></TR>
</TABLE>>, style="filled"];
}
}
}
有没有办法或者骇客或者其他方式来实现这个想法?
Is there a way or a hack or another way to accomplish this idea?
推荐答案
为什么要使用id ="..."语句?通常没有必要.
Why do you want to use the id="..." statement? It's normally not necessary.
如果我对,我不是100%,但是如果您仅将集群32中的节点名称从5更改为6,而不是将标签更改,那么您将具有相同"两个节点的视觉表示在两个集群中.
I'm not 100% if I have you right, but if you just change only the node-name in cluster 32 from 5 to 6, and not the label, then you have the visual representation of "same" two nodes in two cluster.
例如:此:
digraph G {rankdir="LR";
node [fontname = "font-awesome"];
subgraph cluster3 {
4 -> 5 [color="#717070",arrowsize=.5];
8 -> 4[color="#717070",arrowsize=.5];
subgraph cluster31{
4 [fillcolor="#F5BDA2", shape=rect;label=<<TABLE BORDER="0">
<TR><TD>1:12</TD></TR>
</TABLE>>, style="filled",fontsize=6,fixedsize=true,width=0.5,height=0.2,shape=Mrecord];
5 [fillcolor="#F5BDA2", shape=ellipse;label=<<TABLE BORDER="0">
<TR><TD ID="32e" HREF=" ">1:13</TD></TR>
</TABLE>>, style="filled"];
}
subgraph cluster32{
8 [fillcolor="#F5BDA2", shape=rect;label=<<TABLE BORDER="0">
<TR><TD>1:19</TD></TR>
</TABLE>>, style="filled",shape=box];
6 [fillcolor="#F5BDA2", shape=ellipse;label=<<TABLE BORDER="0">
<TR><TD ID="32e" HREF=" ">1:13</TD></TR>
</TABLE>>, style="filled"];
}
}
}
将导致以下结果:
这篇关于Graphviz:两个子图中的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!