Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to the <a href="http://www.graphviz.org/Documentation/pdf/libguide.pdf">GraphViz documentation</a> something like this should do the layout job: </p> <pre><code>- (void) testGraph { Agraph_t* G; GVC_t* gvc; gvc = gvContext(); char* testGraph = "\ digraph G {\ subgraph cluster_c0 {a0 -&gt; a1 -&gt; a2 -&gt; a3;}\ subgraph cluster_c1 {b0 -&gt; b1 -&gt; b2 -&gt; b3;}\ x -&gt; a0;\ x -&gt; b0;\ a1 -&gt; a3;\ a3 -&gt; a0;\ }"; G = agmemread((char*)testGraph); [self dumpGraph:G]; gvLayout (gvc, G, "dot"); NSLog(@"after layout:"); [self dumpGraph:G]; gvFreeLayout(gvc, G); gvFreeContext(gvc); } - (void) printNode:(Agnode_t*) node { NSLog(@"Node: %s {{%f,%f},{%f,%f}}",node-&gt;name, node-&gt;u.coord.x, node-&gt;u.coord.y, ND_width(node), ND_height(node)); } - (void) dumpGraph:(Agraph_t*)graph { if (!graph) return; Agnode_t *n = NULL; Dict_t *dict = graph-&gt;nodes; for (n= dtfirst(dict); n ; n = dtnext(dict, n)) { [self printNode:n]; } } </code></pre> <p>Instead of using logNode: you should write some drawing code.</p> <p>Log output:</p> <pre><code>GraphTest[32319:303] Node: a0 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: a1 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: a2 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: a3 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: b0 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: b1 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: b2 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: b3 {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] Node: x {{0.000000,0.000000},{0.000000,0.000000}} GraphTest[32319:303] after layout: GraphTest[32319:303] Node: a0 {{83.000000,250.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: a1 {{63.000000,178.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: a2 {{43.000000,106.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: a3 {{83.000000,34.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: b0 {{161.000000,250.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: b1 {{161.000000,178.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: b2 {{161.000000,106.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: b3 {{161.000000,34.000000},{0.750000,0.500000}} GraphTest[32319:303] Node: x {{122.000000,322.000000},{0.750000,0.500000}} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload