using gvmap as a library

I've been pleasantly surprised by the quality of xdot rendering, using Graphviz as a library.
Actually, a simple translation from xdot output to Qt graphics primitives now yields a performant and accurate display of complex graphs.
I think I will try to bypass xdot/libxdot to get further memory/time gain, using gvrender_engine_t...

Now my question: it's possible to get gvmap working at the same level of, say, xdot, thus avoiding FILE IO ?
I understand from license terms I could compile the relevant parts, or I'm wrong here ?


You can certainly modify and

You can certainly modify and compile the code however you want.

As to avoiding file IO, the simplest fix is to take the graph gr in plot_dot_map in make_map.c and, instead of writing it to a file, you can call

gvLayout(gvc, gr, "nop2"); gvRender(gvc,gr, fmt, fp);

where fmt is any output format supported by Graphviz and fp is the output FILE*. This is assuming you want to go straight to a concrete image. Actually, I've been meaning to do this anyway, but I just haven't gotten around to it.

If you want to do your own rendering, you just make single call to gvLayout and then read the data from the graph stored in memory, as described in the library manual, or install your own gv_render_engine_t plugin.

To make things even more efficient, one could by-pass creating an attributed graph and attach the layout information directly to the graph, basically making gvmap into a layout engine like dot or neato. This, however, would take a good deal more work, though almost all of it would be bookkeeping.


Recent comments