Graphviz 14.1.3~dev.20260227.0545
Loading...
Searching...
No Matches
layout.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include "config.h"
12
13/* layout.c:
14 * Written by Emden R. Gansner
15 *
16 * This module provides the main bookkeeping for the fdp layout.
17 * In particular, it handles the recursion and the creation of
18 * ports and auxiliary graphs.
19 *
20 * TODO : can we use ports to aid in layout of edges? Note that
21 * at present, they are deleted.
22 *
23 * Can we delay all repositioning of nodes until evalPositions, so
24 * finalCC only sets the bounding boxes?
25 *
26 * Make sure multiple edges have an effect.
27 */
28
29/* uses PRIVATE interface */
30#define FDP_PRIVATE 1
31
32#include "config.h"
33#include <assert.h>
34#include <float.h>
35#include <limits.h>
36#include <inttypes.h>
37#include <assert.h>
38#include <common/render.h>
39#include <common/utils.h>
40#include <fdpgen/tlayout.h>
41#include <math.h>
42#include <neatogen/neatoprocs.h>
43#include <neatogen/adjust.h>
44#include <fdpgen/comp.h>
45#include <pack/pack.h>
46#include <fdpgen/clusteredges.h>
47#include <fdpgen/dbg.h>
48#include <stddef.h>
49#include <stdbool.h>
50#include <util/agxbuf.h>
51#include <util/alloc.h>
52#include <util/list.h>
53
54typedef struct {
55 graph_t* rootg; /* logical root; graph passed in to fdp_layout */
59 int gid;
62
63typedef struct {
65 double alpha;
66 double dist2;
67} erec;
68
69#define NEW_EDGE(e) (ED_to_virt(e) == 0)
70
71/* Set graph bounding box given list of connected
72 * components, each with its bounding box set.
73 * If c_cnt > 1, then pts != NULL and gives translations for components.
74 * Add margin about whole graph unless isRoot is true.
75 * Reposition nodes based on final position of
76 * node's connected component.
77 * Also, entire layout is translated to origin.
78 */
79static void finalCC(graph_t *g, const graphs_t *cc, pointf *pts,
80 graph_t *rg, layout_info* infop) {
81 attrsym_t * G_width = infop->G_width;
82 attrsym_t * G_height = infop->G_height;
83 boxf bb;
84 boxf bbf;
85 pointf pt;
86 int margin;
87 pointf *pp = pts;
88 int isRoot = rg == infop->rootg;
89 int isEmpty = 0;
90
91 /* compute graph bounding box in points */
92 if (!LIST_IS_EMPTY(cc)) {
93 graph_t *cg = LIST_GET(cc, 0);
94 bb = GD_bb(cg);
95 if (LIST_SIZE(cc) > 1) {
96 pt = *pp++;
97 bb.LL.x += pt.x;
98 bb.LL.y += pt.y;
99 bb.UR.x += pt.x;
100 bb.UR.y += pt.y;
101 for (size_t i = 1; i < LIST_SIZE(cc); ++i) {
102 cg = LIST_GET(cc, i);
103 boxf b = GD_bb(cg);
104 pt = *pp++;
105 b.LL.x += pt.x;
106 b.LL.y += pt.y;
107 b.UR.x += pt.x;
108 b.UR.y += pt.y;
109 bb.LL.x = fmin(bb.LL.x, b.LL.x);
110 bb.LL.y = fmin(bb.LL.y, b.LL.y);
111 bb.UR.x = fmax(bb.UR.x, b.UR.x);
112 bb.UR.y = fmax(bb.UR.y, b.UR.y);
113 }
114 }
115 } else { /* empty graph */
116 bb.LL.x = 0;
117 bb.LL.y = 0;
118 bb.UR.x = late_int(rg, G_width, POINTS(DEFAULT_NODEWIDTH), 3);
119 bb.UR.y = late_int(rg, G_height, POINTS(DEFAULT_NODEHEIGHT), 3);
120 isEmpty = 1;
121 }
122
123 if (GD_label(rg)) {
124 isEmpty = 0;
125 double d = round(GD_label(rg)->dimen.x) - (bb.UR.x - bb.LL.x);
126 if (d > 0) { /* height of label added below */
127 d /= 2;
128 bb.LL.x -= d;
129 bb.UR.x += d;
130 }
131 }
132
133 if (isRoot || isEmpty)
134 margin = 0;
135 else
136 margin = late_int (rg, G_margin, CL_OFFSET, 0);
137 pt.x = -bb.LL.x + margin;
138 pt.y = -bb.LL.y + margin + GD_border(rg)[BOTTOM_IX].y;
139 bb.LL.x = 0;
140 bb.LL.y = 0;
141 bb.UR.x += pt.x + margin;
142 bb.UR.y += pt.y + margin + GD_border(rg)[TOP_IX].y;
143
144 /* translate nodes */
145 if (!LIST_IS_EMPTY(cc)) {
146 pp = pts;
147 for (size_t i = 0; i < LIST_SIZE(cc); ++i) {
148 graph_t *const cg = LIST_GET(cc, i);
149 pointf p;
150 node_t *n;
151 pointf del;
152
153 if (pp) {
154 p = *pp++;
155 p.x += pt.x;
156 p.y += pt.y;
157 } else {
158 p = pt;
159 }
160 del.x = PS2INCH(p.x);
161 del.y = PS2INCH(p.y);
162 for (n = agfstnode(cg); n; n = agnxtnode(cg, n)) {
163 ND_pos(n)[0] += del.x;
164 ND_pos(n)[1] += del.y;
165 }
166 }
167 }
168
169 bbf.LL.x = PS2INCH(bb.LL.x);
170 bbf.LL.y = PS2INCH(bb.LL.y);
171 bbf.UR.x = PS2INCH(bb.UR.x);
172 bbf.UR.y = PS2INCH(bb.UR.y);
173 BB(g) = bbf;
174
175}
176
177/* Constructor for a node in a derived graph.
178 * Allocates dndata.
179 */
180static node_t *mkDeriveNode(graph_t * dg, char *name)
181{
182 node_t *dn;
183
184 dn = agnode(dg, name,1);
185 agbindrec(dn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), true); //node custom data
186 ND_alg(dn) = gv_alloc(sizeof(dndata)); // free in freeDeriveNode
187 ND_pos(dn) = gv_calloc(GD_ndim(dg), sizeof(double));
188 return dn;
189}
190
191static void freeDeriveNode(node_t * n)
192{
193 free(ND_alg(n));
194 free(ND_pos(n));
195 agdelrec(n, "Agnodeinfo_t");
196}
197
198static void freeGData(graph_t * g)
199{
200 free(GD_alg(g));
201}
202
203static void freeDerivedGraph(graph_t *g, const graphs_t *cc) {
204 node_t *dn;
205 node_t *dnxt;
206 edge_t *e;
207
208 for (size_t i = 0; i < LIST_SIZE(cc); ++i) {
209 graph_t *const cg = LIST_GET(cc, i);
210 freeGData(cg);
211 agdelrec(cg, "Agraphinfo_t");
212 }
213 if (PORTS(g))
214 free(PORTS(g));
215 freeGData(g);
216 agdelrec(g, "Agraphinfo_t");
217 for (dn = agfstnode(g); dn; dn = dnxt) {
218 dnxt = agnxtnode(g, dn);
219 for (e = agfstout(g, dn); e; e = agnxtout(g, e)) {
220 free (ED_to_virt(e));
221 agdelrec(e, "Agedgeinfo_t");
222 }
223 freeDeriveNode(dn);
224 }
225 agclose(g);
226}
227
228/* The input is laid out, but node coordinates
229 * are relative to smallest containing cluster.
230 * Walk through all nodes and clusters, translating
231 * the positions to absolute coordinates.
232 * Assume that when called, g's bounding box is
233 * in absolute coordinates and that box of root graph
234 * has LL at origin.
235 */
236static void evalPositions(graph_t * g, graph_t* rootg)
237{
238 int i;
239 graph_t *subg;
240 node_t *n;
241 boxf bb;
242 boxf sbb;
243
244 bb = BB(g);
245
246 /* translate nodes in g */
247 if (g != rootg) {
248 for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
249 if (PARENT(n) != g)
250 continue;
251 ND_pos(n)[0] += bb.LL.x;
252 ND_pos(n)[1] += bb.LL.y;
253 }
254 }
255
256 /* translate top-level clusters and recurse */
257 for (i = 1; i <= GD_n_cluster(g); i++) {
258 subg = GD_clust(g)[i];
259 if (g != rootg) {
260 sbb = BB(subg);
261 sbb.LL.x += bb.LL.x;
262 sbb.LL.y += bb.LL.y;
263 sbb.UR.x += bb.LL.x;
264 sbb.UR.y += bb.LL.y;
265 BB(subg) = sbb;
266 }
267 evalPositions(subg, rootg);
268 }
269}
270
271typedef LIST(graph_t *) clist_t;
272
273/* Generate a name for a port.
274 * We use the ids of the nodes.
275 * This is for debugging. For production, just use edge id and some
276 * id for the graph. Note that all the graphs are subgraphs of the
277 * root graph.
278 *
279 * @param out [out] Buffer to write generated name to
280 */
281static char *portName(graph_t *g, bport_t *p, agxbuf *out) {
282 assert(out != NULL);
283
284 edge_t *e = p->e;
285 node_t *h = aghead(e);
286 node_t *t = agtail(e);
287
288 agxbprint(out, "_port_%s_(%d)_(%d)_%u", agnameof(g), ND_id(t), ND_id(h),
289 AGSEQ(e));
290 return agxbuse(out);
291}
292
293/* If cluster has coords attribute, use to supply initial position
294 * of derived node.
295 * Only called if G_coord is defined.
296 * We also look at the parent graph's G_coord attribute. If this
297 * is identical to the child graph, we have to assume the child
298 * inherited it.
299 */
300static void chkPos(graph_t* g, node_t* n, layout_info* infop, boxf* bbp)
301{
302 char *p;
303 char *pp;
304 boxf bb;
305 char c;
307 attrsym_t *G_coord = infop->G_coord;
308
309 p = agxget(g, G_coord);
310 if (p[0]) {
311 if (g != infop->rootg) {
312 parent =agparent(g);
313 pp = agxget(parent, G_coord);
314 if (!strcmp(p, pp))
315 return;
316 }
317 c = '\0';
318 if (sscanf(p, "%lf,%lf,%lf,%lf%c",
319 &bb.LL.x, &bb.LL.y, &bb.UR.x, &bb.UR.y, &c) >= 4) {
320 if (PSinputscale > 0.0) {
321 bb.LL.x /= PSinputscale;
322 bb.LL.y /= PSinputscale;
323 bb.UR.x /= PSinputscale;
324 bb.UR.y /= PSinputscale;
325 }
326 if (c == '!')
327 ND_pinned(n) = P_PIN;
328 else if (c == '?')
329 ND_pinned(n) = P_FIX;
330 else
331 ND_pinned(n) = P_SET;
332 *bbp = bb;
333 } else
334 agwarningf("graph %s, coord %s, expected four doubles\n",
335 agnameof(g), p);
336 }
337}
338
339/* Add real edge e to its image de in the derived graph.
340 * We use the to_virt and count fields to store the list.
341 */
342static void addEdge(edge_t * de, edge_t * e)
343{
344 short cnt = ED_count(de);
345 edge_t **el;
346
347 el = (edge_t**)ED_to_virt(de);
348 el = gv_recalloc(el, cnt, cnt + 1, sizeof(edge_t*));
349 el[cnt] = e;
350 ED_to_virt(de) = (edge_t *) el;
351 ED_count(de)++;
352}
353
355static void
356copyAttr (graph_t* g, graph_t* dg, char* attr)
357{
358 char* ov_val;
359 Agsym_t* ov;
360
361 if ((ov = agattr_text(g,AGRAPH, attr, NULL))) {
362 ov_val = agxget(g,ov);
363 ov = agattr_text(dg,AGRAPH, attr, NULL);
364 if (ov)
365 agxset (dg, ov, ov_val);
366 else {
367 const bool is_html = aghtmlstr(ov_val);
368 is_html ? agattr_html(dg, AGRAPH, attr, ov_val)
369 : agattr_text(dg, AGRAPH, attr, ov_val);
370 }
371 }
372}
373
374/* Create derived graph of g by collapsing clusters into
375 * nodes. An edge is created between nodes if there is
376 * an edge between two nodes in the clusters of the base graph.
377 * Such edges record all corresponding real edges.
378 * In addition, we add a node and edge for each port.
379 */
381{
382 graph_t *dg;
383 node_t *dn;
384 graph_t *subg;
385 bport_t *pp;
386 node_t *n;
387 edge_t *de;
388 int i, id = 0;
389
390 if (Verbose >= 2)
391 fprintf(stderr, "derive graph _dg_%d of %s\n", infop->gid, agnameof(g));
392 infop->gid++;
393
394 dg = agopen("derived", Agstrictdirected,NULL);
395 agbindrec(dg, "Agraphinfo_t", sizeof(Agraphinfo_t), true);
396 GD_alg(dg) = gv_alloc(sizeof(gdata)); // freed in freeDeriveGraph
397#ifdef DEBUG
398 GORIG(dg) = g;
399#endif
400 GD_ndim(dg) = GD_ndim(agroot(g));
401
402 /* Copy attributes from g.
403 */
404 copyAttr(g,dg,"overlap");
405 copyAttr(g,dg,"sep");
406 copyAttr(g,dg,"K");
407
408 /* create derived nodes from clusters */
409 for (i = 1; i <= GD_n_cluster(g); i++) {
410 boxf fix_bb = {{DBL_MAX, DBL_MAX}, {-DBL_MAX, -DBL_MAX}};
411 subg = GD_clust(g)[i];
412
413 do_graph_label(subg);
414 dn = mkDeriveNode(dg, agnameof(subg));
415 ND_clust(dn) = subg;
416 ND_id(dn) = id++;
417 if (infop->G_coord)
418 chkPos(subg, dn, infop, &fix_bb);
419 for (n = agfstnode(subg); n; n = agnxtnode(subg, n)) {
420 DNODE(n) = dn;
421 }
422 if (ND_pinned(dn)) {
423 ND_pos(dn)[0] = (fix_bb.LL.x + fix_bb.UR.x) / 2;
424 ND_pos(dn)[1] = (fix_bb.LL.y + fix_bb.UR.y) / 2;
425 }
426 }
427
428 /* create derived nodes from remaining nodes */
429 for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
430 if (!DNODE(n)) {
431 if (PARENT(n) && PARENT(n) != GPARENT(g)) {
432 agerrorf("node \"%s\" is contained in two non-comparable clusters \"%s\" and \"%s\"\n", agnameof(n), agnameof(g), agnameof(PARENT(n)));
433 return NULL;
434 }
435 PARENT(n) = g;
436 if (IS_CLUST_NODE(n))
437 continue;
438 dn = mkDeriveNode(dg, agnameof(n));
439 DNODE(n) = dn;
440 ND_id(dn) = id++;
441 ND_width(dn) = ND_width(n);
442 ND_height(dn) = ND_height(n);
443 ND_lw(dn) = ND_lw(n);
444 ND_rw(dn) = ND_rw(n);
445 ND_ht(dn) = ND_ht(n);
446 ND_shape(dn) = ND_shape(n);
448 if (ND_pinned(n)) {
449 ND_pos(dn)[0] = ND_pos(n)[0];
450 ND_pos(dn)[1] = ND_pos(n)[1];
451 ND_pinned(dn) = ND_pinned(n);
452 }
453 ANODE(dn) = n;
454 }
455 }
456
457 /* add edges */
458 for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
459 edge_t *e;
460 node_t *hd;
461 node_t *tl = DNODE(n);
462 for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
463 hd = DNODE(aghead(e));
464 if (hd == tl)
465 continue;
466 if (hd > tl)
467 de = agedge(dg, tl, hd, NULL,1);
468 else
469 de = agedge(dg, hd, tl, NULL,1);
470 agbindrec(de, "Agedgeinfo_t", sizeof(Agedgeinfo_t), true);
471 ED_dist(de) = ED_dist(e);
472 ED_factor(de) = ED_factor(e);
473 /* fprintf (stderr, "edge %s -- %s\n", tl->name, hd->name); */
474 WDEG(hd)++;
475 WDEG(tl)++;
476 if (NEW_EDGE(de)) {
477 DEG(hd)++;
478 DEG(tl)++;
479 }
480 addEdge(de, e);
481 }
482 }
483
484 /* transform ports */
485 if ((pp = PORTS(g))) {
486 bport_t *pq;
487 node_t *m;
488 int sz = NPORTS(g);
489
490 /* freed in freeDeriveGraph */
491 PORTS(dg) = pq = gv_calloc(sz + 1, sizeof(bport_t));
492 sz = 0;
493 agxbuf portname = {0};
494 while (pp->e) {
495 m = DNODE(pp->n);
496 /* Create port in derived graph only if hooks to internal node */
497 if (m) {
498 dn = mkDeriveNode(dg, portName(g, pp, &portname));
499 sz++;
500 ND_id(dn) = id++;
501 if (dn > m)
502 de = agedge(dg, m, dn, NULL,1);
503 else
504 de = agedge(dg, dn, m, NULL,1);
505 agbindrec(de, "Agedgeinfo_t", sizeof(Agedgeinfo_t), true);
506 ED_dist(de) = ED_dist(pp->e);
507 ED_factor(de) = ED_factor(pp->e);
508 addEdge(de, pp->e);
509 WDEG(dn)++;
510 WDEG(m)++;
511 DEG(dn)++; /* ports are unique, so this will be the first and */
512 DEG(m)++; /* only time the edge is touched. */
513 pq->n = dn;
514 pq->alpha = pp->alpha;
515 pq->e = de;
516 pq++;
517 }
518 pp++;
519 }
520 agxbfree(&portname);
521 NPORTS(dg) = sz;
522 }
523
524 return dg;
525}
526
528static int ecmp(const void *v1, const void *v2)
529{
530 const erec *e1 = v1;
531 const erec *e2 = v2;
532 if (e1->alpha > e2->alpha)
533 return 1;
534 if (e1->alpha < e2->alpha)
535 return -1;
536 if (e1->dist2 > e2->dist2)
537 return 1;
538 if (e1->dist2 < e2->dist2)
539 return -1;
540 return 0;
541}
542
543#define ANG (M_PI/90) /* Maximum angular change: 2 degrees */
544
545/* Generate list of edges in derived graph g using
546 * node n. The list is in counterclockwise order.
547 * This, of course, assumes we have an initial layout for g.
548 */
550{
551 int deg = DEG(n);
552 int i;
553 double dx, dy;
554 edge_t *e;
555 node_t *m;
556
557 /* freed in expandCluster */
558 erec *erecs = gv_calloc(deg + 1, sizeof(erec));
559 i = 0;
560 for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) {
561 if (aghead(e) == n)
562 m = agtail(e);
563 else
564 m = aghead(e);
565 dx = ND_pos(m)[0] - ND_pos(n)[0];
566 dy = ND_pos(m)[1] - ND_pos(n)[1];
567 erecs[i].e = e;
568 erecs[i].alpha = atan2(dy, dx);
569 erecs[i].dist2 = dx * dx + dy * dy;
570 i++;
571 }
572 assert(i == deg);
573 qsort(erecs, deg, sizeof(erec), ecmp);
574
575 /* ensure no two angles are equal */
576 if (deg >= 2) {
577 int j;
578 double a, inc, delta, bnd;
579
580 i = 0;
581 while (i < deg - 1) {
582 a = erecs[i].alpha;
583 j = i + 1;
584 while (j < deg && erecs[j].alpha == a)
585 j++;
586 if (j == i + 1)
587 i = j;
588 else {
589 if (j == deg)
590 bnd = M_PI; /* all values equal up to end */
591 else
592 bnd = erecs[j].alpha;
593 delta = fmin((bnd - a) / (j - i), ANG);
594 inc = 0;
595 for (; i < j; i++) {
596 erecs[i].alpha += inc;
597 inc += delta;
598 }
599 }
600 }
601 }
602
603 return erecs;
604}
605
606/* Given list of edges with node n in derived graph, add corresponding
607 * ports to port list pp, starting at index idx. Return next index.
608 * If an edge in the derived graph corresponds to multiple real edges,
609 * add them in order if address of n is smaller than other node address.
610 * Otherwise, reverse order.
611 * Attach angles. The value bnd gives next angle after er->alpha.
612 */
613static int
614genPorts(node_t * n, erec * er, bport_t * pp, int idx, double bnd)
615{
616 node_t *other;
617 int cnt;
618 edge_t *e = er->e;
619 edge_t *el;
620 edge_t **ep;
621 double angle, delta;
622 int i, j, inc;
623
624 cnt = ED_count(e);
625
626 if (aghead(e) == n)
627 other = agtail(e);
628 else
629 other = aghead(e);
630
631 delta = fmin((bnd - er->alpha) / cnt, ANG);
632 angle = er->alpha;
633
634 if (n < other) {
635 i = idx;
636 inc = 1;
637 } else {
638 i = idx + cnt - 1;
639 inc = -1;
640 angle += delta * (cnt - 1);
641 delta = -delta;
642 }
643
644 ep = (edge_t **)ED_to_virt(e);
645 for (j = 0; j < ED_count(e); j++, ep++) {
646 el = *ep;
647 pp[i].e = el;
648 pp[i].n = DNODE(agtail(el)) == n ? agtail(el) : aghead(el);
649 pp[i].alpha = angle;
650 i += inc;
651 angle += delta;
652 }
653 return (idx + cnt);
654}
655
656/* Given positioned derived graph cg with node n which corresponds
657 * to a cluster, generate a graph containing the interior of the
658 * cluster, plus port information induced by the layout of cg.
659 * Basically, we use the cluster subgraph to which n corresponds,
660 * attached with port information.
661 */
663{
664 erec *es;
665 erec *ep;
666 erec *next;
667 graph_t *sg = ND_clust(n);
668 int sz = WDEG(n);
669 int idx = 0;
670 double bnd;
671
672 if (sz != 0) {
673 /* freed in cleanup_subgs */
674 bport_t *pp = gv_calloc(sz + 1, sizeof(bport_t));
675
676 /* create sorted list of edges of n */
677 es = ep = getEdgeList(n, cg);
678
679 /* generate ports from edges */
680 while (ep->e) {
681 next = ep + 1;
682 if (next->e)
683 bnd = next->alpha;
684 else
685 bnd = 2 * M_PI + es->alpha;
686 idx = genPorts(n, ep, pp, idx, bnd);
687 ep = next;
688 }
689 assert(idx == sz);
690
691 PORTS(sg) = pp;
692 NPORTS(sg) = sz;
693 free(es);
694 }
695 return sg;
696}
697
698/* At present, cluster nodes are not assigned a position during layout,
699 * but positioned in the center of its associated cluster. Because the
700 * dummy edge associated with a cluster node may not occur at a sufficient
701 * level of cluster, the edge may not be used during layout and we cannot
702 * therefore rely find these nodes via ports.
703 *
704 * In this implementation, we just do a linear pass over all nodes in the
705 * root graph. At some point, we may use a better method, like having each
706 * cluster contain its list of cluster nodes, or have the graph keep a list.
707 *
708 * As nodes, we need to assign cluster nodes the coordinates in the
709 * coordinates of its cluster p. Note that p's bbox is in its parent's
710 * coordinates.
711 *
712 * If routing, we may decide to place on cluster boundary,
713 * and use polyline.
714 */
715static void
717{
718 boxf bb;
719 graph_t* p;
720 pointf ctr;
721 node_t *n;
722 double w, h, h_pts;
723 double h2, w2;
724 pointf *vertices;
725
726 for (n = agfstnode(root); n; n = agnxtnode(root, n)) {
727 if (!IS_CLUST_NODE(n)) continue;
728
729 p = PARENT(n);
730 bb = BB(p); /* bbox in parent cluster's coordinates */
731 w = bb.UR.x - bb.LL.x;
732 h = bb.UR.y - bb.LL.y;
733 ctr.x = w / 2.0;
734 ctr.y = h / 2.0;
735 w2 = INCH2PS(w / 2.0);
736 h2 = INCH2PS(h / 2.0);
737 h_pts = INCH2PS(h);
738 ND_pos(n)[0] = ctr.x;
739 ND_pos(n)[1] = ctr.y;
740 ND_width(n) = w;
741 ND_height(n) = h;
744 ND_outline_width(n) = w + penwidth;
746 /* ND_xsize(n) = POINTS(w); */
747 ND_lw(n) = ND_rw(n) = w2;
748 ND_ht(n) = h_pts;
749
750 vertices = ((polygon_t *) ND_shape_info(n))->vertices;
751 vertices[0].x = ND_rw(n);
752 vertices[0].y = h2;
753 vertices[1].x = -ND_lw(n);
754 vertices[1].y = h2;
755 vertices[2].x = -ND_lw(n);
756 vertices[2].y = -h2;
757 vertices[3].x = ND_rw(n);
758 vertices[3].y = -h2;
759 // allocate extra vertices representing the outline, i.e., the outermost
760 // periphery with penwidth taken into account
761 vertices[4].x = ND_rw(n) + penwidth / 2;
762 vertices[4].y = h2 + penwidth / 2;
763 vertices[5].x = -ND_lw(n) - penwidth / 2;
764 vertices[5].y = h2 + penwidth / 2;
765 vertices[6].x = -ND_lw(n) - penwidth / 2;
766 vertices[6].y = -h2 - penwidth / 2;
767 vertices[7].x = ND_rw(n) + penwidth / 2;
768 vertices[7].y = -h2 - penwidth / 2;
769 }
770}
771
772/* Given g with ports:
773 * Derive g' from g by reducing clusters to points (deriveGraph)
774 * Compute connected components of g' (findCComp)
775 * For each cc of g':
776 * Layout cc (tLayout)
777 * For each node n in cc of g' <-> cluster c in g:
778 * Add ports based on layout of cc to get c' (expandCluster)
779 * Layout c' (recursion)
780 * Remove ports from cc
781 * Expand nodes of cc to reflect size of c' (xLayout)
782 * Pack connected components to get layout of g (putGraphs)
783 * Translate layout so that bounding box of layout + margin
784 * has the origin as LL corner.
785 * Set position of top level clusters and real nodes.
786 * Set bounding box of graph
787 *
788 * TODO:
789 *
790 * Possibly should modify so that only do connected components
791 * on top-level derived graph. Unconnected parts of a cluster
792 * could just rattle within cluster boundaries. This may mix
793 * up components but give a tighter packing.
794 *
795 * Add edges per components to get better packing, rather than
796 * wait until the end.
797 *
798 * @param counter [in,out] State used for constructing distinct subgraph names
799 */
800static int layout(graph_t *g, layout_info* infop, size_t *counter) {
801 pointf *pts = NULL;
802 graph_t *dg;
803 node_t *dn;
804 node_t *n;
805 graph_t *sg;
806 int pinned;
807 xparams xpms;
808
809#ifdef DEBUG
810 incInd();
811#endif
812 if (Verbose) {
813#ifdef DEBUG
814 prIndent();
815#endif
816 fprintf (stderr, "layout %s\n", agnameof(g));
817 }
818 /* initialize derived node pointers */
819 for (n = agfstnode(g); n; n = agnxtnode(g, n))
820 DNODE(n) = 0;
821
822 dg = deriveGraph(g, infop);
823 if (dg == NULL) {
824 return -1;
825 }
826 graphs_t cc = findCComp(dg, &pinned, counter);
827
828 for (size_t i = 0; i < LIST_SIZE(&cc); ++i) {
829 graph_t *const cg = LIST_GET(&cc, i);
830 node_t* nxtnode;
831 fdp_tLayout(cg, &xpms);
832 for (n = agfstnode(cg); n; n = nxtnode) {
833 nxtnode = agnxtnode(cg, n);
834 if (ND_clust(n)) {
835 pointf pt;
836 sg = expandCluster(n, cg); /* attach ports to sg */
837 int r = layout(sg, infop, counter);
838 if (r != 0) {
839 return r;
840 }
841 ND_width(n) = BB(sg).UR.x;
842 ND_height(n) = BB(sg).UR.y;
843 pt.x = POINTS_PER_INCH * BB(sg).UR.x;
844 pt.y = POINTS_PER_INCH * BB(sg).UR.y;
845 ND_rw(n) = ND_lw(n) = pt.x/2;
846 ND_ht(n) = pt.y;
847 } else if (IS_PORT(n))
848 agdelete(cg, n); /* remove ports from component */
849 }
850
851 /* Remove overlaps */
852 if (agnnodes(cg) >= 2) {
853 if (g == infop->rootg)
854 normalize (cg);
855 fdp_xLayout(cg, &xpms);
856 }
857 }
858
859 /* At this point, each connected component has its nodes correctly
860 * positioned. If we have multiple components, we pack them together.
861 * All nodes will be moved to their new positions.
862 * NOTE: packGraphs uses nodes in components, so if port nodes are
863 * not removed, it won't work.
864 */
865 /* Handle special cases well: no ports to real internal nodes
866 * Place cluster edges separately, after layout.
867 * How to combine parts, especially with disparate components?
868 */
869 if (LIST_SIZE(&cc) > 1) {
870 bool *bp;
871 if (pinned) {
872 bp = gv_calloc(LIST_SIZE(&cc), sizeof(bool));
873 bp[0] = true;
874 } else
875 bp = NULL;
876 infop->pack.fixed = bp;
877 pts = putGraphs(LIST_SIZE(&cc), LIST_FRONT(&cc), NULL, &infop->pack);
878 free(bp);
879 } else {
880 pts = NULL;
881 if (LIST_SIZE(&cc) == 1)
882 compute_bb(LIST_GET(&cc, 0));
883 }
884
885 /* set bounding box of dg and reposition nodes */
886 finalCC(dg, &cc, pts, g, infop);
887 free (pts);
888
889 /* record positions from derived graph to input graph */
890 /* At present, this does not record port node info */
891 /* In fact, as noted above, we have removed port nodes */
892 for (dn = agfstnode(dg); dn; dn = agnxtnode(dg, dn)) {
893 if ((sg = ND_clust(dn))) {
894 BB(sg).LL.x = ND_pos(dn)[0] - ND_width(dn) / 2;
895 BB(sg).LL.y = ND_pos(dn)[1] - ND_height(dn) / 2;
896 BB(sg).UR.x = BB(sg).LL.x + ND_width(dn);
897 BB(sg).UR.y = BB(sg).LL.y + ND_height(dn);
898 } else if ((n = ANODE(dn))) {
899 ND_pos(n)[0] = ND_pos(dn)[0];
900 ND_pos(n)[1] = ND_pos(dn)[1];
901 }
902 }
903 BB(g) = BB(dg);
904#ifdef DEBUG
905 if (g == infop->rootg)
906 dump(g, 1);
907#endif
908
909 /* clean up temp graphs */
910 freeDerivedGraph(dg, &cc);
911 LIST_FREE(&cc);
912 if (Verbose) {
913#ifdef DEBUG
914 prIndent ();
915#endif
916 fprintf (stderr, "end %s\n", agnameof(g));
917 }
918#ifdef DEBUG
919 decInd();
920#endif
921
922 return 0;
923}
924
926static void setBB(graph_t * g)
927{
928 int i;
929 boxf bb;
930
931 bb.LL.x = POINTS_PER_INCH * BB(g).LL.x;
932 bb.LL.y = POINTS_PER_INCH * BB(g).LL.y;
933 bb.UR.x = POINTS_PER_INCH * BB(g).UR.x;
934 bb.UR.y = POINTS_PER_INCH * BB(g).UR.y;
935 GD_bb(g) = bb;
936 for (i = 1; i <= GD_n_cluster(g); i++) {
937 setBB(GD_clust(g)[i]);
938 }
939}
940
941/* Initialize graph-dependent information and
942 * state variable.s
943 */
944static void init_info(graph_t * g, layout_info * infop)
945{
946 infop->G_coord = agattr_text(g, AGRAPH, "coords", NULL);
947 infop->G_width = agattr_text(g, AGRAPH, "width", NULL);
948 infop->G_height = agattr_text(g, AGRAPH, "height", NULL);
949 infop->rootg = g;
950 infop->gid = 0;
951 infop->pack.mode = getPackInfo(g, l_node, CL_OFFSET / 2, &infop->pack);
952}
953
954/* Attach list of immediate child clusters.
955 * NB: By convention, the indexing starts at 1.
956 * If pclist is NULL, the graph is the root graph or a cluster
957 * If pclist is non-NULL, we are recursively scanning a non-cluster
958 * subgraph for cluster children.
959 */
960static void
961mkClusters (graph_t * g, clist_t* pclist, graph_t* parent)
962{
963 graph_t* subg;
964 clist_t list = {0};
965 clist_t* clist;
966
967 if (pclist == NULL) {
968 // [0] is empty. The clusters are in [1..cnt].
969 LIST_APPEND(&list, NULL);
970 clist = &list;
971 }
972 else
973 clist = pclist;
974
975 for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg))
976 {
977 if (is_a_cluster(subg)) {
978 agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), true);
979 GD_alg(subg) = gv_alloc(sizeof(gdata)); // freed in cleanup_subgs
980 GD_ndim(subg) = GD_ndim(agroot(parent));
981 LEVEL(subg) = LEVEL(parent) + 1;
982 GPARENT(subg) = parent;
983 LIST_APPEND(clist, subg);
984 mkClusters(subg, NULL, subg);
985 }
986 else {
987 mkClusters(subg, clist, parent);
988 }
989 }
990 if (pclist == NULL) {
991 assert(LIST_SIZE(&list) - 1 <= INT_MAX);
992 GD_n_cluster(g) = (int)(LIST_SIZE(&list) - 1);
993 if (LIST_SIZE(&list) > 1) {
994 LIST_SHRINK_TO_FIT(&list);
995 LIST_DETACH(&list, &GD_clust(g), NULL);
996 } else {
997 LIST_FREE(&list);
998 }
999 }
1000}
1001
1002static void fdp_init_graph(Agraph_t * g)
1003{
1005 GD_alg(g) = gv_alloc(sizeof(gdata)); // freed in cleanup_graph
1006 GD_ndim(agroot(g)) = late_int(g, agattr_text(g,AGRAPH, "dim", NULL), 2, 2);
1007 Ndim = GD_ndim(agroot(g)) = MIN(GD_ndim(agroot(g)), MAXDIM);
1008
1009 mkClusters (g, NULL, g);
1010 fdp_initParams(g);
1012}
1013
1014static int fdpLayout(graph_t * g)
1015{
1017
1018 init_info(g, &info);
1019 int r = layout(g, &info, &(size_t){0});
1020 if (r != 0) {
1021 return r;
1022 }
1023 setClustNodes(g);
1024 evalPositions(g,g);
1025
1026 /* Set bbox info for g and all clusters. This is needed for
1027 * spline drawing. We already know the graph bbox is at the origin.
1028 * On return from spline drawing, all bounding boxes should be correct.
1029 */
1030 setBB(g);
1031
1032 return 0;
1033}
1034
1035static void
1037{
1038 int trySplines = 0;
1039 int et = EDGE_TYPE(g);
1040
1041 if (et > EDGETYPE_ORTHO) {
1042 if (et == EDGETYPE_COMPOUND) {
1043 trySplines = splineEdges(g, compoundEdges, EDGETYPE_SPLINE);
1044 /* When doing the edges again, accept edges done by compoundEdges */
1045 if (trySplines)
1046 Nop = 2;
1047 }
1048 if (trySplines || et != EDGETYPE_COMPOUND) {
1049 if (HAS_CLUST_EDGE(g)) {
1050 agwarningf(
1051 "splines and cluster edges not supported - using line segments\n");
1052 et = EDGETYPE_LINE;
1053 } else {
1054 spline_edges1(g, et);
1055 }
1056 }
1057 Nop = 0;
1058 }
1059 if (State < GVSPLINES)
1060 spline_edges1(g, et);
1061}
1062
1064{
1065 double save_scale = PSinputscale;
1066
1068 fdp_init_graph(g);
1069 if (fdpLayout(g) != 0) {
1070 return;
1071 }
1073
1074 if (EDGE_TYPE(g) != EDGETYPE_NONE) fdpSplines (g);
1075
1076 gv_postprocess(g, 0);
1077 PSinputscale = save_scale;
1078}
int normalize(graph_t *g)
Definition adjust.c:722
static void out(agerrlevel_t level, const char *fmt, va_list args)
Report messages using a user-supplied or default write function.
Definition agerror.c:86
Dynamically expanding string buffers.
static void agxbfree(agxbuf *xb)
free any malloced resources
Definition agxbuf.h:97
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
Definition agxbuf.h:252
static WUR char * agxbuse(agxbuf *xb)
Definition agxbuf.h:325
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
Definition alloc.h:73
static void * gv_calloc(size_t nmemb, size_t size)
Definition alloc.h:26
static void * gv_alloc(size_t size)
Definition alloc.h:47
#define MIN(a, b)
Definition arith.h:28
#define M_PI
Definition arith.h:41
#define DNODE(n)
Definition circular.h:75
#define PARENT(n)
Definition circular.h:84
#define parent(i)
Definition closest.c:75
int compoundEdges(graph_t *g, expand_t *pm, int edgetype)
void setEdgeType(graph_t *g, int defaultValue)
Definition utils.c:1423
int late_int(void *obj, attrsym_t *attr, int defaultValue, int minimum)
Definition utils.c:40
double late_double(void *obj, attrsym_t *attr, double defaultValue, double minimum)
Definition utils.c:55
double get_inputscale(graph_t *g)
Definition utils.c:78
void compute_bb(graph_t *g)
Definition utils.c:634
bool is_a_cluster(Agraph_t *g)
Definition utils.c:696
graphs_t findCComp(graph_t *g, int *pinned, size_t *counter)
Definition comp.c:62
#define P_PIN
Definition const.h:249
#define BOTTOM_IX
Definition const.h:111
#define P_SET
Definition const.h:247
#define TOP_IX
Definition const.h:113
#define EDGETYPE_SPLINE
Definition const.h:239
#define CL_OFFSET
Definition const.h:142
#define DEFAULT_NODEHEIGHT
Definition const.h:72
#define DEFAULT_NODEPENWIDTH
Definition const.h:77
#define DEFAULT_NODEWIDTH
Definition const.h:74
#define MAXDIM
Definition const.h:160
#define P_FIX
Definition const.h:248
#define EDGETYPE_ORTHO
Definition const.h:238
#define MIN_NODEPENWIDTH
Definition const.h:78
#define EDGETYPE_LINE
Definition const.h:235
#define EDGETYPE_NONE
Definition const.h:234
#define GVSPLINES
Definition const.h:164
#define EDGETYPE_COMPOUND
Definition const.h:240
static float dy
Definition draw.c:43
static float dx
Definition draw.c:42
static void del(Dict_t *d, Dtlink_t **set, Agedge_t *e)
Definition edge.c:158
void fdp_init_node_edge(Agraph_t *g)
Definition fdpinit.c:88
#define PS2INCH(a_points)
Definition geom.h:64
#define POINTS(a_inches)
Definition geom.h:62
#define POINTS_PER_INCH
Definition geom.h:58
#define INCH2PS(a_inches)
Definition geom.h:63
int State
Definition globals.h:63
int Nop
Definition globals.h:55
Agsym_t * G_margin
Definition globals.h:72
Agsym_t * N_penwidth
Definition globals.h:80
double PSinputscale
Definition globals.h:56
unsigned short Ndim
Definition globals.h:62
static bool Verbose
Definition gml2gv.c:26
void free(void *)
node NULL
Definition grammar.y:181
static int cnt(Dict_t *d, Dtlink_t **set)
Definition graph.c:198
int agnnodes(Agraph_t *g)
Definition graph.c:157
Agsym_t * agattr_text(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up text attributes of a graph
Definition attr.c:333
int agxset(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:521
char * agxget(void *obj, Agsym_t *sym)
Definition attr.c:457
Agsym_t * agattr_html(Agraph_t *g, int kind, char *name, const char *value)
agattr_text, but creates HTML-like values
Definition attr.c:337
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition edge.c:255
#define ED_dist(e)
Definition types.h:602
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Definition edge.c:28
#define ED_count(e)
Definition types.h:580
#define agtail(e)
Definition cgraph.h:977
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Definition edge.c:98
#define ED_factor(e)
Definition types.h:585
#define aghead(e)
Definition cgraph.h:978
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Definition edge.c:43
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
Definition edge.c:89
#define ED_to_virt(e)
Definition types.h:599
void agwarningf(const char *fmt,...)
Definition agerror.c:175
void agerrorf(const char *fmt,...)
Definition agerror.c:167
#define GD_border(g)
Definition types.h:359
#define GD_clust(g)
Definition types.h:360
#define GD_alg(g)
Definition types.h:358
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:97
#define GD_bb(g)
Definition types.h:354
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Definition graph.c:273
#define GD_n_cluster(g)
Definition types.h:389
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Definition graph.c:44
#define GD_ndim(g)
Definition types.h:390
#define GD_label(g)
Definition types.h:374
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:143
#define ND_outline_width(n)
Definition types.h:516
#define ND_outline_height(n)
Definition types.h:517
#define ND_ht(n)
Definition types.h:500
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Definition node.c:50
Agnode_t * agfstnode(Agraph_t *g)
Definition node.c:43
#define ND_pinned(n)
Definition types.h:519
#define ND_clust(n)
Definition types.h:489
#define ND_alg(n)
Definition types.h:484
#define ND_rw(n)
Definition types.h:525
#define ND_height(n)
Definition types.h:498
#define ND_width(n)
Definition types.h:536
#define ND_lw(n)
Definition types.h:506
#define ND_shape_info(n)
Definition types.h:529
#define ND_pos(n)
Definition types.h:520
#define ND_shape(n)
Definition types.h:528
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:145
int agdelete(Agraph_t *g, void *obj)
deletes object. Equivalent to agclose, agdelnode, and agdeledge for obj being a graph,...
Definition obj.c:22
Agraph_t * agroot(void *obj)
Definition obj.c:170
#define AGSEQ(obj)
Definition cgraph.h:225
@ AGRAPH
Definition cgraph.h:207
void * agbindrec(void *obj, const char *name, unsigned int recsize, int move_to_front)
attaches a new record of the given size to the object
Definition rec.c:91
int agdelrec(void *obj, const char *name)
deletes a named record from one object
Definition rec.c:139
int aghtmlstr(const char *)
Definition refstr.c:440
Agraph_t * agparent(Agraph_t *g)
Definition subg.c:88
Agraph_t * agfstsubg(Agraph_t *g)
Definition subg.c:75
Agraph_t * agnxtsubg(Agraph_t *subg)
Definition subg.c:80
static double penwidth[]
void do_graph_label(graph_t *sg)
Set characteristics of graph label if it exists.
Definition input.c:837
static erec * getEdgeList(node_t *n, graph_t *g)
Definition layout.c:549
static void fdpSplines(graph_t *g)
Definition layout.c:1036
static void setBB(graph_t *g)
set point box g->bb from inch box BB(g)
Definition layout.c:926
static void init_info(graph_t *g, layout_info *infop)
Definition layout.c:944
static void fdp_init_graph(Agraph_t *g)
Definition layout.c:1002
void fdp_layout(graph_t *g)
Definition layout.c:1063
static void evalPositions(graph_t *g, graph_t *rootg)
Definition layout.c:236
static int genPorts(node_t *n, erec *er, bport_t *pp, int idx, double bnd)
Definition layout.c:614
static int ecmp(const void *v1, const void *v2)
sort edges by angle, then distance
Definition layout.c:528
static void addEdge(edge_t *de, edge_t *e)
Definition layout.c:342
static void chkPos(graph_t *g, node_t *n, layout_info *infop, boxf *bbp)
Definition layout.c:300
static node_t * mkDeriveNode(graph_t *dg, char *name)
Definition layout.c:180
static graph_t * expandCluster(node_t *n, graph_t *cg)
Definition layout.c:662
static void freeDeriveNode(node_t *n)
Definition layout.c:191
static int fdpLayout(graph_t *g)
Definition layout.c:1014
static void freeDerivedGraph(graph_t *g, const graphs_t *cc)
Definition layout.c:203
#define ANG
Definition layout.c:543
static void copyAttr(graph_t *g, graph_t *dg, char *attr)
copy given attribute from g to dg
Definition layout.c:356
static void freeGData(graph_t *g)
Definition layout.c:198
#define NEW_EDGE(e)
Definition layout.c:69
static void setClustNodes(graph_t *root)
Definition layout.c:716
static void mkClusters(graph_t *g, clist_t *pclist, graph_t *parent)
Definition layout.c:961
static void finalCC(graph_t *g, const graphs_t *cc, pointf *pts, graph_t *rg, layout_info *infop)
Definition layout.c:79
static graph_t * deriveGraph(graph_t *g, layout_info *infop)
Definition layout.c:380
static int layout(graph_t *g, layout_info *infop, size_t *counter)
Definition layout.c:800
type-generic dynamically expanding list
#define LIST_DETACH(list, datap, sizep)
Definition list.h:443
#define LIST(type)
Definition list.h:55
#define LIST_SIZE(list)
Definition list.h:80
#define LIST_APPEND(list, item)
Definition list.h:120
#define LIST_FREE(list)
Definition list.h:370
#define LIST_SHRINK_TO_FIT(list)
Definition list.h:358
#define LIST_FRONT(list)
Definition list.h:180
#define LIST_IS_EMPTY(list)
Definition list.h:90
#define LIST_GET(list, index)
Definition list.h:155
#define IS_CLUST_NODE(n)
Definition macros.h:23
#define EDGE_TYPE(g)
Definition macros.h:25
#define HAS_CLUST_EDGE(g)
Definition macros.h:24
#define delta
Definition maze.c:136
#define ND_id(n)
Definition mm2gv.c:41
NEATOPROCS_API bool neato_set_aspect(graph_t *g)
NEATOPROCS_API int splineEdges(graph_t *, int(*edgefn)(graph_t *, expand_t *, int), int)
NEATOPROCS_API int spline_edges1(graph_t *g, int)
pack_mode getPackInfo(Agraph_t *g, pack_mode dflt, int dfltMargin, pack_info *pinfo)
Definition pack.c:1284
pointf * putGraphs(size_t ng, Agraph_t **gs, Agraph_t *root, pack_info *pinfo)
Definition pack.c:891
support for connected components
@ l_node
Definition pack.h:55
void gv_postprocess(Agraph_t *g, int allowTranslation)
Definition postproc.c:599
#define alpha
Definition shapes.c:4058
static double cg(SparseMatrix A, const double *precond, int n, int dim, double *x0, double *rhs, double tol, double maxit)
graph or subgraph
Definition cgraph.h:424
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:640
Definition geom.h:41
pointf UR
Definition geom.h:41
pointf LL
Definition geom.h:41
Definition layout.c:63
double dist2
Definition layout.c:66
edge_t * e
Definition layout.c:64
double alpha
Definition layout.c:65
attrsym_t * G_coord
Definition layout.c:56
pack_info pack
Definition layout.c:60
attrsym_t * G_width
Definition layout.c:57
int gid
Definition layout.c:59
graph_t * rootg
Definition layout.c:55
attrsym_t * G_height
Definition layout.c:58
pack_mode mode
Definition pack.h:72
bool * fixed
Definition pack.h:73
double x
Definition geom.h:29
double y
Definition geom.h:29
Definition heap.c:20
void fdp_initParams(graph_t *g)
initialize parameters based on root graph attributes
Definition tlayout.c:153
void fdp_tLayout(graph_t *g, xparams *xpms)
Definition tlayout.c:574
void fdp_xLayout(graph_t *g, xparams *xpms)
Definition xlayout.c:325