Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tree visualization with libgraphviz / dot

Tags:

c

graphviz

does anyone have some experience with libgraphviz using the standard c library?

For my current project i would like to write a simple tool which visualize one of my abstract syntax tree in a jpg image or maybe even on a small X11 window. Graphviz itself provides seven, different libraries i could use and link to my application:

  • cdt
  • cgraph
  • gvc
  • pack
  • pathplan
  • xdot

Unfortanetly, i have no idea which library is necessary for my task. I also don't need to translate my tree representation to the dot language and would like write it directly to an image. (Of course, it Would be also great using an API that abstracts the transformation to the dot language).

Thanks for each advice :)

like image 697
Ruun Avatar asked Oct 25 '25 13:10

Ruun


2 Answers

Please take a look at the libguide.pdf on the graphviz web site. The guide explains how to use graphviz as a library and contains sample programs in c.

The examples also show how to add nodes and edges, and depending on your tree representation, it may be relatively simple to translate it to node and edge creation calls.

like image 58
marapet Avatar answered Oct 27 '25 01:10

marapet


If you chart isn't too big and if you are ok with a bargain basement hack, you could try Google Charts.

http://code.google.com/apis/chart/image/docs/gallery/graphviz.html

You build a URL and Google builds an image.

Sample Generated Graphviz Image

like image 29
Rick Avatar answered Oct 27 '25 02:10

Rick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!