Re: [graphviz-interest] CGraph C API and dot rendering: how to render the graph left-to-right?
"Emden R. Gansner" <[email protected]> Fri, 03 Jan 2014 18:37:14 -0500
| Newsgroups | gmane.comp.video.graphviz |
|---|---|
| Message-ID | <[email protected]> |
On 1/3/14 6:00 PM, Jeremy Friesner wrote:
> Hi all,
>
> I have a C++ program that uses the CGraph API (in conjunction with the "dot" rendering engine to render a directed graph. Here is an example of a rendered graph in my program:
>
> http://www.lcscanada.com/jaf/avb_graph.png
>
> That works fine, but it would be preferable if the graph's nodes were placed such that the edges flowed from left to right, rather than top to bottom. Here's a mockup showing roughly the layout I would prefer:
>
> http://www.lcscanada.com/jaf/lr_graph.png
>
> Does anyone know what I can do to achieve this?
>
> I tried the following (directly after my call to agopen(NULL, Agdirected, NULL))):
>
> SET_RANKDIR(mygraph, RANKDIR_LR);
>
> as well as
>
> SET_RANKDIR(mygraph, (RANKDIR_LR<<2)|RANKDIR_LR);
>
>
I believe you've got the right attribute but the wrong API. Try using
the string-valued approach:
agsafeset(mygraph,"rankdir","LR","");
(The macros in types.h are intended to be read-only after you've done
the graph layout.)
Emden
_______________________________________________
[email protected]
http://lists.research.att.com/mailman/listinfo/graphviz-interest