caduceus
caduceus

Reputation: 1828

How to style graphviz terminal nodes only?

I use the targetIncludes goal of the depgraph-maven-plugin to produce a dot file, and generate a graph.

When I configure the "dot" layout engine its obvious where the terminal nodes are - at the bottom of the diagram. But if I switch to the "fdp" layout its difficult to make them out.

How can I style/color these terminal nodes differently during the generation of the dot file? (obviously I could edit the dot file afterwards)

Upvotes: 0

Views: 109

Answers (1)

sroush
sroush

Reputation: 6773

(I don't know about depgraph-maven capabilities).
The Graphviz language does not include any conditionals, however it includes a pre-processor/post-processor language - gvpr (https://www.graphviz.org/pdf/gvpr.1.pdf) that can easily color terminal nodes.
If you can produce output with format = canon or dot (https://graphviz.org/docs/outputs/canon/) then run that file through gvpr like so:

gvpr -c 'N{if($.indegree=="0"||$.outdegree=="0"){$.style="filled";$.color="red";};}' myoutputfile 

Then run that file thru fdp, neato, dot, or whatever engine you like.

Upvotes: 2

Related Questions