7

I know there are several versions of Graphviz as a library. But I'm a bit confused as to which one is considered current + recommended. I would like to generate and display a few graphs from a linux GUI application.

According to http://www.graphviz.org/doc/libgraph/Agraph.pdf on page 22, Libgraph was replaced by Cgraph. But the document is called Agraph, which I find strange.

On page 23, it also says Lgraph is a C++ successor to Cgraph, and since I'm using C++, I'd love to know more, but I cannot seem to find Lgraph anywhere.

Perhaps related, I do see there is a Boost library called BGL which supports importing and exporting graphviz files. Looking for opinions on whether it is preferable to use BGL over Graphviz directly or Lgraph.

It looks like on Ubuntu if I sudo apt-get install libgraphviz-dev I get Cgraph. In which case, this question is to either confirm Cgraph is the recommended library, and to ask if either Lgraph or BGL are worth considering.

Stéphane
  • 19,459
  • 24
  • 95
  • 136
  • 1
    The C api of cgraph (http://www.graphviz.org/doc/libguide/libguide.pdf) doesn't look too bad, it's pretty much classically object-oriented except written in C. – Walter Nissen Jul 11 '13 at 21:31
  • Vague question. "Generate some graphs" - what does this mean? Graphviz lays out graphs so that can be displayed clearly. BGL is a framework for processing graphs to answer questions like what is the shortest path. But you want to generate graphs ... from what? – ravenspoint Oct 27 '13 at 14:14
  • @ravenspoint: I have internal data that I can output as a .gv file for example. I can manually create a bunch of .gv files and then do system() calls to ask dot to convert those into graphs. But I was instead hoping to do it all with a Graphviz API than having to call Graphviz externally. – Stéphane Nov 11 '13 at 11:20

1 Answers1

3

BGL does not provide interactive interfaces to Graphviz; if you need that, you will need to use one of Graphviz's native libraries such as cgraph. BGL can read and output Graphviz-format files, but that does not seem like what you are looking for; it also has some layout algorithms of its own, but they are not as sophisticated as those in Graphviz.

Jeremiah Willcock
  • 30,161
  • 7
  • 76
  • 78
  • Does the clause "but they are not as sophisticated as those in Graphviz" still hold for Boost 1.59 (http://www.boost.org/doc/libs/1_59_0/libs/graph/doc/topology.html)? – AlwaysLearning Nov 12 '15 at 13:36