graphgraphvizdot

How do I only show some nodes (edges) on graphviz and not others


I have a very complex graph, and there is no way that I can show it all and understand it. I need to make simplified versions of it showing only some nodes and not others. I don't just want the other nodes to be invisible, but to really be absent (so that the graph is simplified).

The solution would be to make a graph with only some layers. But is that possible? What other options are there?

Thanks, Pietro


Solution

  • I found a possible solution. It uses gvpr which is already included with my machine's Graphviz installation.

    You can set up gvpr to read a .dot file, follow some instructions, and produce another .dot file.

    So I added a property tag="TAGfoo TAGgoo TAGsoo". There are probably better ways, but since I need to use regular expression, this works well enough.

    Then the command:

    gvpr -i 'N[tag=="(*TAGfoo*|*TAGgoo*)"]' filesource.dot >fileproduced.dot
    

    will take only the nodes that have TAGfoo or TAGgoo.

    It could be made cleaner.