0

are they easy ways

  1. to display only a subset of the subgraphs I have defined without commenting or else?
  2. to disable all colors/have a black and white version of the graph

thanks

P.S: it is for teaching/presentation purpose

stackoverflower
  • 301
  • 4
  • 14
  • 1. do you want the visible clusters to stay in fixed positions? 2. what OS and what output format are you using? – sroush Aug 24 '21 at 19:02
  • 1. yes it would be great. The cluster positioning is rather random, 2 dot files with identical semantic(same graph but different "dot description") can generate completely different graphical rendering 2. i am generating the graph in svg from a dot file under windows 10 – stackoverflower Aug 25 '21 at 14:56

1 Answers1

2

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

sroush
  • 5,375
  • 2
  • 5
  • 11