Is Graphviz the best tool for this type of charting?

I want to create a graph similar to the one shown below ... but too complicated. I want to use separate images for each of the square nodes and the same image for each of the nodes of the circle.

I want to know if using GraphViz is the best option or are there other options?

Also, I would like to know if I can create a node template in GraphViz for a circle and reuse it? I do not want to indicate attributes such as image, shape, etc. again and again.

Sample graph

+7
source share
2 answers

Graphviz is definitely suitable for what you ask. At the moment, the main site graphviz.org is not working yet, but someone kindly reflected the gallery examples (with source) Flickr.

http://www.flickr.com/photos/kentbye/sets/72157601523153827/

As far as I know, you cannot create “templates”, but you can do something similar for circles:

node[shape=circle, color=white, style=solid]; node1;node2;node3; 

This will define the node (think of it as a “state” when evaluating the file one at a time), and then you can define your circle nodes in this “state” before switching to your rectangles.

Depending on your platform, you can also import your .dot file and configure it to publish. There are also a large number of generators and converters for the format.

Remember that if you are working on Mac OS X 10.7 “Lion”, I have not yet been able to find or create a working version of Graphviz. In this case, I would say that it is not yet suitable for your needs.

+8
source

Of course, here is the code to draw a graph in your Question (and which is shown by a dotted line below).

 digraph g { rankdir = TB; bgcolor = white; edge[arrowsize=.7, color=black]; node[shape=box, color=black] {rank=same; a, b, c}; {rank=same; d, e, f}; {rank=same; g, h}; {rank=same; i, j, k}; d[color=blue; shape=circle]; e[color=blue; shape=circle]; k[color=blue; shape=circle]; a -> d; b -> d; b -> e; c -> e; d -> g; e -> h; d -> i; d -> j; j -> k; h -> k; k -> f; } 


  • The first line of the digraph is for the directed graph (for graphs in which the edges have a direction).

  • The fourth and fifth lie above the set default attributes for edges and nodes, respectively. In other words, once you have done this, you only need to use the style (including attributes + values) of the nodes (or edges) that you want to style differently from the default values. You can have more than one node "template by creating subgraphs or discrete groups of nodes (see the points guide).

  • rank = same allows you to specify a group of nodes that have the same vertical position (provided that rankdir is set to TB, which means "Top-Down").

  • By default, the name node (e.g. a, b, c on my chart) is used as node. If you do not want this displayed on the chart, just set label = ""

enter image description here

+12
source

All Articles