I have been trying to implement a Venn Diagram in Dot. Whilst Venn Diagrams probably aren't that useful in Dot, it's mostly so I can use it as a very basic building block.
I have provided some ways that I have tried to do this:
graph G {
subgraph cluster0 {
color=white;
subgraph cluster0 {
label="1";
color=black;
a;
b;
}
subgraph cluster1 {
label="2";
color=black;
b;
c;
}
}
subgraph cluster1 {
color=white;
subgraph cluster2 {
label="1";
color=black;
d;
}
subgraph cluster3 {
label="1+2";
color=black;
e;
}
subgraph cluster4 {
label="2";
color=black;
f;
}
}
subgraph cluster2 {
color=white;
subgraph cluster5 {
label="1";
color=black;
g;
subgraph cluster6 {
label="2";
color=black;
h;
}
}
subgraph cluster6 {
label="2";
color=black;
i;
}
}
a -- d -- g [penwidth=0];
b -- e -- h [penwidth=0];
c -- f -- i [penwidth=0];
}
Producing:
These all have problems:
- The first says
b
is in1
, but not2
. When it should be in both. - The second looks like it's separate from
1
and2
. And can be hard to show it's both. - The third is almost perfect IMO, it just requires the two
2
sub-graphs to join together.
To prevent an XY problem, I have:
- two servers,
- a docker swarm between the two servers, and
three applications. Located at:
- One is on the first server, not in the docker swarm.
- One is on the first server in the docker swarm.
- One is on the second server in the docker swarm.
Leading to:
graph G {
subgraph cluster0 {
color=white;
subgraph cluster0 {
label="Server1";
color=black;
a;
subgraph cluster0 {
label="Docker";
b;
}
}
subgraph cluster1 {
label="Server2";
color=black;
subgraph cluster0 {
label="Docker";
c;
}
}
}
subgraph cluster1 {
color=white;
subgraph cluster0 {
label="Server1";
color=black;
d;
}
subgraph cluster1 {
label="Docker";
color=black;
subgraph cluster0 {
label="Server1";
e;
}
subgraph cluster1 {
label="Server2";
f;
}
}
}
a -- d [penwidth=0];
b -- e [penwidth=0];
c -- f [penwidth=0];
}