Which graphviz library API is recommended for a C++ project that needs to generate some graphs?

StackOverflow https://stackoverflow.com/questions/15910527

Pregunta

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.

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top