dependenciesgraphvizdot

Is there an option to automatically remove "redundant" edges in a dot graph?


I create a dot graph of dependencies for my Debian projects (see picture). The dependencies include redundant edges. I'd like to have a simpler graph without those redundant edges. I could calculate those on my own, but it's not too easy since I generate the .dot file in my CMakeLists.txt and .cmake extensions.

So I'm wondering whether there would be an option in dot or Graphviz to remove edges that are not required. So for example, the top snapwebsites project depends on csspp and advgetopt. Since the cspp package already depends on advgetopt, there is no need for the edge between snapwebsites and advgetopt.

In the digraph, this would mean:

"snapwebsites" -> "advgetopt";     <-- "auto-remove" this one
"snapwebsites" -> "csspp";

"csspp" -> "advgetopt";

So, is there such an option?

enter image description here


Solution

  • There is also the tred program distributed with graphviz.

    tred computes the transitive reduction of directed graphs, and prints the resulting graphs to standard output. This removes edges implied by transitivity. Nodes and subgraphs are not otherwise affected. The ``meaning'' and validity of the reduced graphs is application dependent. tred is particularly useful as a preprocessor to dot to reduce clutter in dense layouts.