0

For a graph created in a specialized library like JGraphT, subpath calculations can be made and subgraphs with paths of length up to a maximum value N can be derived prior to visualizing.

Is there any simple way of doing the same thing, without such calculations, i.e. of pruning all paths of length larger than N in a graph defined in a Graphviz DOT script, using only that script and without any limitation on the graph type (e.g., DAG or other)?

Maybe via the gvpr tool?

PNS
  • 19,295
  • 32
  • 96
  • 143
  • 1
    Look at the gvpr program "dechain", probably found in /usr/share/graphviz/gvpr/. I think it almost does what you want. It would not be a trivial tweak to prune based on length, bu "dechain" is a place to start. Note that if you don't check the intermediate nodes for indegree & outdegree==1, you will probably get a bad result. – sroush Jul 19 '20 at 18:57
  • The purpose of your question isn't entirely clear, so it is a bit hard to make well-informed suggestions. `JGraphT` can read/parse/write from/to a huge number of graph formats. It would be trivial to (1) read the graph in DOT format into JGraphT, (2) manipulate the graph (3) export the result again in DOT format to file. Or perhaps in your case: use JGraphT to read the graph in DOT format, and perform the desired subpath calculations. – Joris Kinable Jul 20 '20 at 18:24

0 Answers0