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