are they easy ways
thanks
P.S: it is for teaching/presentation purpose
The layers feature (https://graphviz.org/faq/#FaqOverlays) is the "best" way to produce a subset graph. But there are severl oddities in the implementation (e.g. https://forum.graphviz.org/t/stupid-dot-tricks-2-making-a-video/109) that make it a bit of a pain. An example:
digraph CL {
graph [layers="A:C:D"]
subgraph cluster1{
node [layer="A,C,D"]
a->b->c->{e f}
}
subgraph cluster11{
node [layer="C,D"]
ax->bx->{cx ex fx}
}
subgraph cluster12{
node [layer="D"]
ay->{by cy ey fy}
}
subgraph clusterZAZ{
node [layer="A,D"]
a55->{b55 c55 e55 frrrr}
}
// comment out the next line and see what happens
edge [layer=D] // this should not be necessary
ax->by
}
Here is a command line to produce layer C:
dot -Tsvg -Glayerselect=C clusterLayers.gv >C.svg
Maybe Inkscape (https://inkscape.org/) convert a colored SVG graph to black-and-white