GraphViz edge labels

cdata-visualizationdotgraphviz

I'm trying to draw a graph of the dependencies between C header files using graphviz.

Basically, what I'm doing is log all the #include that appear and the condition (#if conditions I mean). If a file includes another one, it becomes its father in the graph and the potential condition is the edge label.

I obtain a pretty large graph. The problem stems from the edge labels which are always horizontal (you cannot change that) and always seem to be left-align (I've tried labelloc and labeljust but it doesn't change anything. What is the correct way to "center" the label of one edge.

To avoid this problem, I've tried to render conditions as nodes. If A.h includes B.h under ANSI condition, there's a link from A.h to ANSI and then from ANSI to B.h… That looks ok, but the problem is that if C.h include D.h under the same condition, I would see a link from A.h to ANSI, one from to C.h to ANSI; one from ANSI to B.h and one from ANSI to D.h . The problem is I don't know if it's A.h or C.h that includes B.h . Is there a way to specify something like go through nodes (a link from A.h to B.h that goes under ANSI maybe leveraging transparency.)

Best Answer

labelloc and labeljust are meaningless for edges. See here, it says "GC" as Graph, Cluster or "N" as Node, respectively.

You could, however, consider generating unique nodes for each condition with labels. Then there would be multiple nodes with different "dot ID's", but a same label (condition's text), so it would be clear if it was A.h or C.h that incuded B.h. I think You will be pleased with the results, as You already stated that it looks ok.

Good luck!

Related Topic