Node in two differents clusters

Hi everyone,
I'm new in graphviz, and i'm wondering how can i draw nodes that are included in two or three clusters, like this :

digraph{
subgraph cluster1 {
node1;
node2;
}
subgraph cluster2 {
node3;
node4;
}
subgraph cluster3 {
node4 -> node2;
}
}

The result that i want is in image attachement.
Thank you very much for your answers.

AttachmentSize
clusters.png5.26 KB

erg is correct, I added

erg is correct, I added background color to cluster3 and commented out cluster1 but left its nodes. As you can see only node2 not being already in a cluster gets cluster3 color:
http://t.co/ofJAHpvdfO

Hermann.

Sorry, this type of thing

Sorry, this type of thing isn't possible directly in Graphviz. Nodes in clusters and subclusters have to form a simple hierarchy. Your example is simple, but in general allowing nonhierarchies leads one to the problem of drawing Euler diagrams, which is not simple.

If you really have very simple graphs, it might be possible to add some constraints to get a drawing to which you can add cluster boundaries in postprocessing. Let me know if you want more information.

Recent comments