GraphViz: Compress automatically generated graph

2019-02-07 12:09发布

问题:

I am trying to visualize two columns of an an Excel file: Column A contains categories, while Column B contains individual entries. The dot file is generated by Excel using the following formula:

=IFERROR(CONCATENATE("subgraph cluster_",A2,"{""",B2,"""","; label =""",A2,"""}"),"")

Afterwards the "unflatten" utility is used to distribute the nodes more evenly, and finally the "dot" is used to generate the graph

unflatten.exe -f -l 4 -c 6 -o FLATTENED.dot INPUTFILE.dot
dot -Tpng FLATTENED.dot > FLATTENED.png

The following graph is generated

I would like to make the graph more compact, and align the categories to the upper egde of the page, what commands should I look into to improve the resulting output?

I've attached the dot file

回答1:

Here's an idea:

  • Instead of one graph with x clusters create a dot file with x graphs
  • unflatten them
  • then use gvpack to pack all graphs together
  • and neato to layout

The basic idea is to use graphs instead of clusters so you can use gvpack to pack the graphs.

Something like:

unflatten -f -l 4 -c 6 input.dot | dot | gvpack -array_t6 | neato -s -n2 -Tpng -o output.png

Not sure though whether unflatten handles files with several graphs.

(Sorry, no time to check it).



标签: graphviz