Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
position.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
12/*
13 * position(g): set ND_coord(n) (x and y) for all nodes n of g, using GD_rank(g).
14 * (the graph may be modified by merging certain edges with a common endpoint.)
15 * the coordinates are computed by constructing and ranking an auxiliary graph.
16 * then leaf nodes are inserted in the fast graph. cluster boundary nodes are
17 * created and correctly separated.
18 */
19
20#include <common/geomprocs.h>
21#include <cgraph/alloc.h>
22#include <cgraph/gv_math.h>
23#include <dotgen/dot.h>
24#include <dotgen/aspect.h>
25#include <math.h>
26#include <stdbool.h>
27#include <stdlib.h>
28
29static int nsiter2(graph_t * g);
30static void create_aux_edges(graph_t * g);
31static void remove_aux_edges(graph_t * g);
32static void set_xcoords(graph_t * g);
33static void set_ycoords(graph_t * g);
34static void set_aspect(graph_t *g);
35static void expand_leaves(graph_t * g);
36static void make_lrvn(graph_t * g);
37static void contain_nodes(graph_t * g);
38static bool idealsize(graph_t * g, double);
39
40#if defined(DEBUG) && DEBUG > 1
41static void
42dumpNS (graph_t * g)
43{
44 node_t* n = GD_nlist(g);
45 elist el;
46 edge_t* e;
47
48 while (n) {
49 el = ND_out(n);
50 for (size_t i = 0; i < el.size; i++) {
51 e = el.list[i];
52 fprintf (stderr, "%s(%x) -> ", agnameof(agtail(e)),agtail(e));
53 fprintf (stderr, "%s(%x) : %d\n", agnameof(aghead(e)), aghead(e),
54 ED_minlen(e));
55 }
56 n = ND_next(n);
57 }
58}
59#endif
60
61static double
62largeMinlen (double l)
63{
65 "Edge length %f larger than maximum %d allowed.\nCheck for overwide "
66 "node(s).\n",
67 l, INT_MAX);
68 return (double)INT_MAX;
69}
70
71/* When source and/or sink nodes are defined, it is possible that
72 * after the auxiliary edges are added, the graph may still have 2 or
73 * 3 components. To fix this, we put trivial constraints connecting the
74 * first items of each rank.
75 */
76static void
78{
79 int i, j, r;
80 bool found;
81 node_t* tp;
82 node_t* hp;
83 node_t* sn;
84 edge_t* e;
85 rank_t* rp;
86
87 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
88 rp = GD_rank(g)+r;
89 found = false;
90 tp = NULL;
91 for (i = 0; i < rp->n; i++) {
92 tp = rp->v[i];
93 if (ND_save_out(tp).list) {
94 for (j = 0; (e = ND_save_out(tp).list[j]); j++) {
95 if (ND_rank(aghead(e)) > r || ND_rank(agtail(e)) > r) {
96 found = true;
97 break;
98 }
99 }
100 if (found) break;
101 }
102 if (ND_save_in(tp).list) {
103 for (j = 0; (e = ND_save_in(tp).list[j]); j++) {
104 if (ND_rank(agtail(e)) > r || ND_rank(aghead(e)) > r) {
105 found = true;
106 break;
107 }
108 }
109 if (found) break;
110 }
111 }
112 if (found || !tp) continue;
113 tp = rp->v[0];
114 if (r < GD_maxrank(g)) hp = (rp+1)->v[0];
115 else hp = (rp-1)->v[0];
116 assert (hp);
117 sn = virtual_node(g);
119 make_aux_edge(sn, tp, 0, 0);
120 make_aux_edge(sn, hp, 0, 0);
121 ND_rank(sn) = MIN(ND_rank(tp), ND_rank(hp));
122 }
123}
124
126 if (GD_nlist(g) == NULL)
127 return; /* ignore empty graph */
128 mark_lowclusters(g); /* we could remove from splines.c now */
129 set_ycoords(g);
130 if (Concentrate)
132 expand_leaves(g);
133 if (flat_edges(g))
134 set_ycoords(g);
136 if (rank(g, 2, nsiter2(g))) { /* LR balance == 2 */
137 connectGraph (g);
138 const int rank_result = rank(g, 2, nsiter2(g));
139 assert(rank_result == 0);
140 (void)rank_result;
141 }
142 set_xcoords(g);
143 set_aspect(g);
144 remove_aux_edges(g); /* must come after set_aspect since we now
145 * use GD_ln and GD_rn for bbox width.
146 */
147}
148
149static int nsiter2(graph_t * g)
150{
151 int maxiter = INT_MAX;
152 char *s;
153
154 if ((s = agget(g, "nslimit")))
155 maxiter = scale_clamp(agnnodes(g), atof(s));
156 return maxiter;
157}
158
159static bool go(node_t *u, node_t *v) {
160 int i;
161 edge_t *e;
162
163 if (u == v)
164 return true;
165 for (i = 0; (e = ND_out(u).list[i]); i++) {
166 if (go(aghead(e), v))
167 return true;
168 }
169 return false;
170}
171
172static bool canreach(node_t *u, node_t *v) {
173 return go(u, v);
174}
175
176edge_t *make_aux_edge(node_t * u, node_t * v, double len, int wt)
177{
178 edge_t *e;
179
180 Agedgepair_t* e2 = gv_alloc(sizeof(Agedgepair_t));
181 AGTYPE(&(e2->in)) = AGINEDGE;
182 AGTYPE(&(e2->out)) = AGOUTEDGE;
183 e2->out.base.data = gv_alloc(sizeof(Agedgeinfo_t));
184 e = &(e2->out);
185
186 agtail(e) = u;
187 aghead(e) = v;
188 if (len > INT_MAX)
189 len = largeMinlen (len);
190 ED_minlen(e) = ROUND(len);
191 ED_weight(e) = wt;
192 fast_edge(e);
193 return e;
194}
195
197{
198 int i, j, n_in;
199 node_t *n;
200
201 /* allocate space for aux edge lists */
202 for (n = GD_nlist(g); n; n = ND_next(n)) {
203 ND_save_in(n) = ND_in(n);
204 ND_save_out(n) = ND_out(n);
205 for (i = 0; ND_out(n).list[i]; i++);
206 for (j = 0; ND_in(n).list[j]; j++);
207 n_in = i + j;
208 alloc_elist(n_in + 3, ND_in(n));
209 alloc_elist(3, ND_out(n));
210 }
211}
212
213static void
215{
216 int i, j;
217 int m0;
218 double width;
219 int sep[2];
220 int nodesep; /* separation between nodes on same rank */
221 edge_t *e, *e0, *e1, *ff;
222 node_t *u, *v, *t0, *h0;
223 rank_t *rank = GD_rank(g);
224
225 /* Use smaller separation on odd ranks if g has edge labels */
226 if (GD_has_labels(g->root) & EDGE_LABEL) {
227 sep[0] = GD_nodesep(g);
228 sep[1] = 5;
229 }
230 else {
231 sep[1] = sep[0] = GD_nodesep(g);
232 }
233 /* make edges to constrain left-to-right ordering */
234 for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
235 double last;
236 last = ND_rank(rank[i].v[0]) = 0;
237 nodesep = sep[i & 1];
238 for (j = 0; j < rank[i].n; j++) {
239 u = rank[i].v[j];
240 ND_mval(u) = ND_rw(u); /* keep it somewhere safe */
241 if (ND_other(u).size > 0) { /* compute self size */
242 /* FIX: dot assumes all self-edges go to the right. This
243 * is no longer true, though makeSelfEdge still attempts to
244 * put as many as reasonable on the right. The dot code
245 * should be modified to allow a box reflecting the placement
246 * of all self-edges, and use that to reposition the nodes.
247 * Note that this would not only affect left and right
248 * positioning but may also affect interrank spacing.
249 */
250 double sw = 0; // self width
251 for (size_t k = 0; (e = ND_other(u).list[k]); k++) {
252 if (agtail(e) == aghead(e)) {
253 sw += selfRightSpace (e);
254 }
255 }
256 ND_rw(u) += sw; /* increment to include self edges */
257 }
258 v = rank[i].v[j + 1];
259 if (v) {
260 width = ND_rw(u) + ND_lw(v) + nodesep;
261 e0 = make_aux_edge(u, v, width, 0);
262 last = (ND_rank(v) = last + width);
263 }
264
265 /* constraints from labels of flat edges on previous rank */
266 if ((e = ND_alg(u))) {
267 e0 = ND_save_out(u).list[0];
268 e1 = ND_save_out(u).list[1];
269 if (ND_order(aghead(e0)) > ND_order(aghead(e1))) {
270 ff = e0;
271 e0 = e1;
272 e1 = ff;
273 }
274 m0 = ED_minlen(e) * GD_nodesep(g) / 2;
275 double m1 = m0 + ND_rw(aghead(e0)) + ND_lw(agtail(e0));
276 /* these guards are needed because the flat edges
277 * work very poorly with cluster layout */
278 if (!canreach(agtail(e0), aghead(e0)))
279 make_aux_edge(aghead(e0), agtail(e0), m1,
280 ED_weight(e));
281 m1 = m0 + ND_rw(agtail(e1)) + ND_lw(aghead(e1));
282 if (!canreach(aghead(e1), agtail(e1)))
283 make_aux_edge(agtail(e1), aghead(e1), m1,
284 ED_weight(e));
285 }
286
287 /* position flat edge endpoints */
288 for (size_t k = 0; k < ND_flat_out(u).size; k++) {
289 e = ND_flat_out(u).list[k];
290 if (ND_order(agtail(e)) < ND_order(aghead(e))) {
291 t0 = agtail(e);
292 h0 = aghead(e);
293 } else {
294 t0 = aghead(e);
295 h0 = agtail(e);
296 }
297
298 width = ND_rw(t0) + ND_lw(h0);
299 m0 = ED_minlen(e) * GD_nodesep(g) + width;
300
301 if ((e0 = find_fast_edge(t0, h0))) {
302 /* flat edge between adjacent neighbors
303 * ED_dist contains the largest label width.
304 */
305 m0 = MAX(m0, width + GD_nodesep(g) + ROUND(ED_dist(e)));
306 ED_minlen(e0) = MAX(ED_minlen(e0), m0);
307 ED_weight(e0) = MAX(ED_weight(e0), ED_weight(e));
308 }
309 else if (!ED_label(e)) {
310 /* unlabeled flat edge between non-neighbors
311 * ED_minlen(e) is max of ED_minlen of all equivalent
312 * edges.
313 */
314 make_aux_edge(t0, h0, m0, ED_weight(e));
315 }
316 /* labeled flat edges between non-neighbors have already
317 * been constrained by the label above.
318 */
319 }
320 }
321 }
322}
323
325static void make_edge_pairs(graph_t * g)
326{
327 int i, m0, m1;
328 node_t *n, *sn;
329 edge_t *e;
330
331 for (n = GD_nlist(g); n; n = ND_next(n)) {
332 if (ND_save_out(n).list)
333 for (i = 0; (e = ND_save_out(n).list[i]); i++) {
334 sn = virtual_node(g);
336 m0 = (ED_head_port(e).p.x - ED_tail_port(e).p.x);
337 if (m0 > 0)
338 m1 = 0;
339 else {
340 m1 = -m0;
341 m0 = 0;
342 }
343 make_aux_edge(sn, agtail(e), m0 + 1, ED_weight(e));
344 make_aux_edge(sn, aghead(e), m1 + 1, ED_weight(e));
345 ND_rank(sn) =
346 MIN(ND_rank(agtail(e)) - m0 - 1,
347 ND_rank(aghead(e)) - m1 - 1);
348 }
349 }
350}
351
353{
354 int c;
355 edge_t *e;
356
357 if (g != dot_root(g)) {
358 contain_nodes(g);
359 if ((e = find_fast_edge(GD_ln(g),GD_rn(g)))) /* maybe from lrvn()?*/
360 ED_weight(e) += 128;
361 else
362 make_aux_edge(GD_ln(g), GD_rn(g), 1, 128); /* clust compaction edge */
363 }
364 for (c = 1; c <= GD_n_cluster(g); c++)
366}
367
369 edge_t *e;
370
371 if (ND_node_type(v) != VIRTUAL)
372 return false;
373 for (e = ND_save_out(v).list[0]; ED_to_orig(e); e = ED_to_orig(e));
374 if (agcontains(g, agtail(e)))
375 return false;
376 if (agcontains(g, aghead(e)))
377 return false;
378 return true;
379}
380
381/* Guarantee nodes outside the cluster g are placed outside of it.
382 * This is done by adding constraints to make sure such nodes have
383 * a gap of margin from the left or right bounding box node ln or rn.
384 *
385 * We could probably reduce some of these constraints by checking if
386 * the node is in a cluster, since elsewhere we make constrain a
387 * separate between clusters. Also, we should be able to skip the
388 * first loop if g is the root graph.
389 */
391{
392 int i, c, r, margin;
393 node_t *u, *v;
394
395 margin = late_int (g, G_margin, CL_OFFSET, 0);
396 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
397 if (GD_rank(g)[r].n == 0)
398 continue;
399 v = GD_rank(g)[r].v[0];
400 if (v == NULL)
401 continue;
402 for (i = ND_order(v) - 1; i >= 0; i--) {
403 u = GD_rank(dot_root(g))[r].v[i];
404 /* can't use "is_a_vnode_of" because elists are swapped */
405 if (ND_node_type(u) == NORMAL || vnode_not_related_to(g, u)) {
406 make_aux_edge(u, GD_ln(g), margin + ND_rw(u), 0);
407 break;
408 }
409 }
410 for (i = ND_order(v) + GD_rank(g)[r].n; i < GD_rank(dot_root(g))[r].n;
411 i++) {
412 u = GD_rank(dot_root(g))[r].v[i];
413 if (ND_node_type(u) == NORMAL || vnode_not_related_to(g, u)) {
414 make_aux_edge(GD_rn(g), u, margin + ND_lw(u), 0);
415 break;
416 }
417 }
418 }
419
420 for (c = 1; c <= GD_n_cluster(g); c++)
422}
423
424/* Make sure boxes of subclusters of g are offset from the
425 * box of g. This is done by a constraint between the left and
426 * right bounding box nodes ln and rn of g and a subcluster.
427 * The gap needs to include any left or right labels.
428 */
429static void contain_subclust(graph_t * g)
430{
431 int margin, c;
432 graph_t *subg;
433
434 margin = late_int (g, G_margin, CL_OFFSET, 0);
435 make_lrvn(g);
436 for (c = 1; c <= GD_n_cluster(g); c++) {
437 subg = GD_clust(g)[c];
438 make_lrvn(subg);
439 make_aux_edge(GD_ln(g), GD_ln(subg),
440 margin + GD_border(g)[LEFT_IX].x, 0);
441 make_aux_edge(GD_rn(subg), GD_rn(g),
442 margin + GD_border(g)[RIGHT_IX].x, 0);
443 contain_subclust(subg);
444 }
445}
446
447/* Guarantee space between subcluster of g.
448 * This is done by adding a constraint between the right bbox node rn
449 * of the left cluster and the left bbox node ln of the right cluster.
450 * This is only done if the two clusters overlap in some rank.
451 */
453{
454 int i, j, margin;
455 graph_t *low, *high;
456 graph_t *left, *right;
457
458 margin = late_int (g, G_margin, CL_OFFSET, 0);
459 for (i = 1; i <= GD_n_cluster(g); i++)
460 make_lrvn(GD_clust(g)[i]);
461 for (i = 1; i <= GD_n_cluster(g); i++) {
462 for (j = i + 1; j <= GD_n_cluster(g); j++) {
463 low = GD_clust(g)[i];
464 high = GD_clust(g)[j];
465 if (GD_minrank(low) > GD_minrank(high)) {
466 graph_t *temp = low;
467 low = high;
468 high = temp;
469 }
470 if (GD_maxrank(low) < GD_minrank(high))
471 continue;
472 if (ND_order(GD_rank(low)[GD_minrank(high)].v[0])
473 < ND_order(GD_rank(high)[GD_minrank(high)].v[0])) {
474 left = low;
475 right = high;
476 } else {
477 left = high;
478 right = low;
479 }
480 make_aux_edge(GD_rn(left), GD_ln(right), margin, 0);
481 }
483 }
484}
485
486/* create constraints for:
487 * node containment in clusters,
488 * cluster containment in clusters,
489 * separation of sibling clusters.
490 */
491static void pos_clusters(graph_t * g)
492{
493 if (GD_n_cluster(g) > 0) {
498 }
499}
500
501static void compress_graph(graph_t * g)
502{
503 double x;
504 pointf p;
505
506 if (GD_drawing(g)->ratio_kind != R_COMPRESS)
507 return;
508 p = GD_drawing(g)->size;
509 if (p.x * p.y <= 1)
510 return;
511 contain_nodes(g);
512 if (!GD_flip(g))
513 x = p.x;
514 else
515 x = p.y;
516
517 /* Guard against huge size attribute since max. edge length is USHRT_MAX
518 * A warning might be called for. Also, one could check that the graph
519 * already fits GD_drawing(g)->size and return immediately.
520 */
521 x = MIN(x,USHRT_MAX);
522 make_aux_edge(GD_ln(g), GD_rn(g), x, 1000);
523}
524
525static void create_aux_edges(graph_t * g)
526{
530 pos_clusters(g);
532}
533
534static void remove_aux_edges(graph_t * g)
535{
536 int i;
537 node_t *n, *nnext, *nprev;
538 edge_t *e;
539
540 for (n = GD_nlist(g); n; n = ND_next(n)) {
541 for (i = 0; (e = ND_out(n).list[i]); i++) {
542 free(e->base.data);
543 free(e);
544 }
545 free_list(ND_out(n));
546 free_list(ND_in(n));
547 ND_out(n) = ND_save_out(n);
548 ND_in(n) = ND_save_in(n);
549 }
550 /* cannot be merged with previous loop */
551 nprev = NULL;
552 for (n = GD_nlist(g); n; n = nnext) {
553 nnext = ND_next(n);
554 if (ND_node_type(n) == SLACKNODE) {
555 if (nprev)
556 ND_next(nprev) = nnext;
557 else
558 GD_nlist(g) = nnext;
559 free(n->base.data);
560 free(n);
561 } else
562 nprev = n;
563 }
564 ND_prev(GD_nlist(g)) = NULL;
565}
566
568static void
570{
571 int i, j;
572 node_t *v;
573 rank_t *rank = GD_rank(g);
574
575 for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
576 for (j = 0; j < rank[i].n; j++) {
577 v = rank[i].v[j];
578 ND_coord(v).x = ND_rank(v);
579 ND_rank(v) = i;
580 }
581 }
582}
583
584/* Expand cluster height by delta, adding half to top
585 * and half to bottom. If the bottom expansion exceeds the
586 * ht1 of the rank, shift the ranks in the cluster up.
587 * If the top expansion, including any shift from the bottom
588 * expansion, exceeds to ht2 of the rank, shift the ranks above
589 * the cluster up.
590 *
591 * FIX: There can be excess space between ranks. Not sure where this is
592 * coming from but it could be cleaned up.
593 */
594static void adjustSimple(graph_t *g, double delta, int margin_total) {
595 int r;
596 double deltop;
597 graph_t *root = dot_root(g);
598 rank_t *rank = GD_rank(root);
599 int maxr = GD_maxrank(g);
600 int minr = GD_minrank(g);
601
602 const double bottom = (delta + 1) / 2;
603 const double delbottom = GD_ht1(g) + bottom - (rank[maxr].ht1 - margin_total);
604 if (delbottom > 0) {
605 for (r = maxr; r >= minr; r--) {
606 if (rank[r].n > 0)
607 ND_coord(rank[r].v[0]).y += delbottom;
608 }
609 deltop = GD_ht2(g) + (delta-bottom) + delbottom - (rank[minr].ht2 - margin_total);
610 }
611 else
612 deltop = GD_ht2(g) + (delta-bottom) - (rank[minr].ht2 - margin_total);
613 if (deltop > 0) {
614 for (r = minr-1; r >= GD_minrank(root); r--) {
615 if (rank[r].n > 0)
616 ND_coord(rank[r].v[0]).y += deltop;
617 }
618 }
619 GD_ht2(g) += delta - bottom;
620 GD_ht1(g) += bottom;
621}
622
623/* Recursively adjust ranks to take into account
624 * wide cluster labels when rankdir=LR.
625 * We divide the extra space between the top and bottom.
626 * Adjust the ht1 and ht2 values in the process.
627 */
628static void adjustRanks(graph_t * g, int margin_total)
629{
630 double lht; /* label height */
631 double rht; /* height between top and bottom ranks */
632 int maxr, minr, margin;
633 int c;
634 double delta, ht1, ht2;
635
637 if (g == dot_root(g))
638 margin = 0;
639 else
640 margin = late_int (g, G_margin, CL_OFFSET, 0);
641
642 ht1 = GD_ht1(g);
643 ht2 = GD_ht2(g);
644
645 for (c = 1; c <= GD_n_cluster(g); c++) {
646 graph_t *subg = GD_clust(g)[c];
647 adjustRanks(subg, margin+margin_total);
648 if (GD_maxrank(subg) == GD_maxrank(g))
649 ht1 = fmax(ht1, GD_ht1(subg) + margin);
650 if (GD_minrank(subg) == GD_minrank(g))
651 ht2 = fmax(ht2, GD_ht2(subg) + margin);
652 }
653
654 GD_ht1(g) = ht1;
655 GD_ht2(g) = ht2;
656
657 if (g != dot_root(g) && GD_label(g)) {
658 lht = MAX(GD_border(g)[LEFT_IX].y, GD_border(g)[RIGHT_IX].y);
659 maxr = GD_maxrank(g);
660 minr = GD_minrank(g);
661 rht = ND_coord(rank[minr].v[0]).y - ND_coord(rank[maxr].v[0]).y;
662 delta = lht - (rht + ht1 + ht2);
663 if (delta > 0) {
664 adjustSimple(g, delta, margin_total);
665 }
666 }
667
668 /* update the global ranks */
669 if (g != dot_root(g)) {
670 rank[GD_minrank(g)].ht2 = fmax(rank[GD_minrank(g)].ht2, GD_ht2(g));
671 rank[GD_maxrank(g)].ht1 = fmax(rank[GD_maxrank(g)].ht1, GD_ht1(g));
672 }
673}
674
675/* recursively compute cluster ht requirements. assumes GD_ht1(subg) and ht2
676 * are computed from primitive nodes only. updates ht1 and ht2 to reflect
677 * cluster nesting and labels. also maintains global rank ht1 and ht2.
678 * Return true if some cluster has a label.
679 */
680static int clust_ht(Agraph_t * g)
681{
682 int c;
683 double ht1, ht2;
684 graph_t *subg;
686 int margin, haveClustLabel = 0;
687
688 if (g == dot_root(g))
689 margin = CL_OFFSET;
690 else
691 margin = late_int (g, G_margin, CL_OFFSET, 0);
692
693 ht1 = GD_ht1(g);
694 ht2 = GD_ht2(g);
695
696 /* account for sub-clusters */
697 for (c = 1; c <= GD_n_cluster(g); c++) {
698 subg = GD_clust(g)[c];
699 haveClustLabel |= clust_ht(subg);
700 if (GD_maxrank(subg) == GD_maxrank(g))
701 ht1 = MAX(ht1, GD_ht1(subg) + margin);
702 if (GD_minrank(subg) == GD_minrank(g))
703 ht2 = MAX(ht2, GD_ht2(subg) + margin);
704 }
705
706 /* account for a possible cluster label in clusters */
707 /* room for root graph label is handled in dotneato_postprocess */
708 if ((g != dot_root(g)) && GD_label(g)) {
709 haveClustLabel = 1;
710 if (!GD_flip(agroot(g))) {
711 ht1 += GD_border(g)[BOTTOM_IX].y;
712 ht2 += GD_border(g)[TOP_IX].y;
713 }
714 }
715 GD_ht1(g) = ht1;
716 GD_ht2(g) = ht2;
717
718 /* update the global ranks */
719 if (g != dot_root(g)) {
720 rank[GD_minrank(g)].ht2 = MAX(rank[GD_minrank(g)].ht2, ht2);
721 rank[GD_maxrank(g)].ht1 = MAX(rank[GD_maxrank(g)].ht1, ht1);
722 }
723
724 return haveClustLabel;
725}
726
727/* set y coordinates of nodes, a rank at a time */
728static void set_ycoords(graph_t * g)
729{
730 int i, j, r;
731 double ht2, maxht, delta, d0, d1;
732 node_t *n;
733 edge_t *e;
734 rank_t *rank = GD_rank(g);
735 graph_t *clust;
736 int lbl;
737
738 ht2 = maxht = 0;
739
740 /* scan ranks for tallest nodes. */
741 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
742 for (i = 0; i < rank[r].n; i++) {
743 n = rank[r].v[i];
744
745 /* assumes symmetry, ht1 = ht2 */
746 ht2 = ND_ht(n) / 2;
747
748
749 /* have to look for high self-edge labels, too */
750 if (ND_other(n).list)
751 for (j = 0; (e = ND_other(n).list[j]); j++) {
752 if (agtail(e) == aghead(e)) {
753 if (ED_label(e))
754 ht2 = fmax(ht2, ED_label(e)->dimen.y / 2);
755 }
756 }
757
758 /* update global rank ht */
759 if (rank[r].pht2 < ht2)
760 rank[r].pht2 = rank[r].ht2 = ht2;
761 if (rank[r].pht1 < ht2)
762 rank[r].pht1 = rank[r].ht1 = ht2;
763
764 /* update nearest enclosing cluster rank ht */
765 if ((clust = ND_clust(n))) {
766 int yoff = (clust == g ? 0 : late_int (clust, G_margin, CL_OFFSET, 0));
767 if (ND_rank(n) == GD_minrank(clust))
768 GD_ht2(clust) = fmax(GD_ht2(clust), ht2 + yoff);
769 if (ND_rank(n) == GD_maxrank(clust))
770 GD_ht1(clust) = fmax(GD_ht1(clust), ht2 + yoff);
771 }
772 }
773 }
774
775 /* scan sub-clusters */
776 lbl = clust_ht(g);
777
778 /* make the initial assignment of ycoords to leftmost nodes by ranks */
779 maxht = 0;
780 r = GD_maxrank(g);
781 (ND_coord(rank[r].v[0])).y = rank[r].ht1;
782 while (--r >= GD_minrank(g)) {
783 d0 = rank[r + 1].pht2 + rank[r].pht1 + GD_ranksep(g); /* prim node sep */
784 d1 = rank[r + 1].ht2 + rank[r].ht1 + CL_OFFSET; /* cluster sep */
785 delta = fmax(d0, d1);
786 if (rank[r].n > 0) /* this may reflect some problem */
787 (ND_coord(rank[r].v[0])).y = (ND_coord(rank[r + 1].v[0])).y + delta;
788#ifdef DEBUG
789 else
790 fprintf(stderr, "dot set_ycoords: rank %d is empty\n",
791 rank[r].n);
792#endif
793 maxht = fmax(maxht, delta);
794 }
795
796 /* If there are cluster labels and the drawing is rotated, we need special processing to
797 * allocate enough room. We use adjustRanks for this, and then recompute the maxht if
798 * the ranks are to be equally spaced. This seems simpler and appears to work better than
799 * handling equal spacing as a special case.
800 */
801 if (lbl && GD_flip(g)) {
802 adjustRanks(g, 0);
803 if (GD_exact_ranksep(g)) { /* recompute maxht */
804 maxht = 0;
805 r = GD_maxrank(g);
806 d0 = (ND_coord(rank[r].v[0])).y;
807 while (--r >= GD_minrank(g)) {
808 d1 = (ND_coord(rank[r].v[0])).y;
809 delta = d1 - d0;
810 maxht = fmax(maxht, delta);
811 d0 = d1;
812 }
813 }
814 }
815
816 /* re-assign if ranks are equally spaced */
817 if (GD_exact_ranksep(g)) {
818 for (r = GD_maxrank(g) - 1; r >= GD_minrank(g); r--)
819 if (rank[r].n > 0) /* this may reflect the same problem :-() */
820 (ND_coord(rank[r].v[0])).y=
821 (ND_coord(rank[r + 1].v[0])).y + maxht;
822 }
823
824 /* copy ycoord assignment from leftmost nodes to others */
825 for (n = GD_nlist(g); n; n = ND_next(n))
826 ND_coord(n).y = (ND_coord(rank[ND_rank(n)].v[0])).y;
827}
828
829/* Compute bounding box of g.
830 * The x limits of clusters are given by the x positions of ln and rn.
831 * This information is stored in the rank field, since it was calculated
832 * using network simplex.
833 * For the root graph, we don't enforce all the constraints on lr and
834 * rn, so we traverse the nodes and subclusters.
835 */
836static void dot_compute_bb(graph_t * g, graph_t * root)
837{
838 int r, c;
839 double x, offset;
840 node_t *v;
841 pointf LL, UR;
842
843 if (g == dot_root(g)) {
844 LL.x = (double)INT_MAX;
845 UR.x = (double)-INT_MAX;
846 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
847 int rnkn = GD_rank(g)[r].n;
848 if (rnkn == 0)
849 continue;
850 if ((v = GD_rank(g)[r].v[0]) == NULL)
851 continue;
852 for (c = 1; (ND_node_type(v) != NORMAL) && c < rnkn; c++)
853 v = GD_rank(g)[r].v[c];
854 if (ND_node_type(v) == NORMAL) {
855 x = ND_coord(v).x - ND_lw(v);
856 LL.x = MIN(LL.x, x);
857 }
858 else continue;
859 /* At this point, we know the rank contains a NORMAL node */
860 v = GD_rank(g)[r].v[rnkn - 1];
861 for (c = rnkn-2; ND_node_type(v) != NORMAL; c--)
862 v = GD_rank(g)[r].v[c];
863 x = ND_coord(v).x + ND_rw(v);
864 UR.x = MAX(UR.x, x);
865 }
867 for (c = 1; c <= GD_n_cluster(g); c++) {
868 x = (double)(GD_bb(GD_clust(g)[c]).LL.x - offset);
869 LL.x = MIN(LL.x, x);
870 x = (double)(GD_bb(GD_clust(g)[c]).UR.x + offset);
871 UR.x = MAX(UR.x, x);
872 }
873 } else {
874 LL.x = (double)(ND_rank(GD_ln(g)));
875 UR.x = (double)(ND_rank(GD_rn(g)));
876 }
877 LL.y = ND_coord(GD_rank(root)[GD_maxrank(g)].v[0]).y - GD_ht1(g);
878 UR.y = ND_coord(GD_rank(root)[GD_minrank(g)].v[0]).y + GD_ht2(g);
879 GD_bb(g).LL = LL;
880 GD_bb(g).UR = UR;
881}
882
883static void rec_bb(graph_t * g, graph_t * root)
884{
885 int c;
886 for (c = 1; c <= GD_n_cluster(g); c++)
887 rec_bb(GD_clust(g)[c], root);
888 dot_compute_bb(g, root);
889}
890
891/* Recursively rescale all bounding boxes using scale factors
892 * xf and yf. We assume all the bboxes have been computed.
893 */
894static void scale_bb(graph_t * g, graph_t * root, double xf, double yf)
895{
896 int c;
897
898 for (c = 1; c <= GD_n_cluster(g); c++)
899 scale_bb(GD_clust(g)[c], root, xf, yf);
900 GD_bb(g).LL.x *= xf;
901 GD_bb(g).LL.y *= yf;
902 GD_bb(g).UR.x *= xf;
903 GD_bb(g).UR.y *= yf;
904}
905
906/* Set bounding boxes and, if ratio is set, rescale graph.
907 * Note that if some dimension shrinks, there may be problems
908 * with labels.
909 */
910static void set_aspect(graph_t *g) {
911 double xf = 0.0, yf = 0.0, actual, desired;
912 node_t *n;
913 bool filled;
914
915 rec_bb(g, g);
916 if (GD_maxrank(g) > 0 && GD_drawing(g)->ratio_kind) {
917 pointf sz = {.x = GD_bb(g).UR.x - GD_bb(g).LL.x,
918 .y = GD_bb(g).UR.y - GD_bb(g).LL.y}; // normalize
919 if (GD_flip(g)) {
920 sz = exch_xyf(sz);
921 }
922 bool scale_it = true;
923 if (GD_drawing(g)->ratio_kind == R_AUTO)
924 filled = idealsize(g, .5);
925 else
926 filled = GD_drawing(g)->ratio_kind == R_FILL;
927 if (filled) {
928 /* fill is weird because both X and Y can stretch */
929 if (GD_drawing(g)->size.x <= 0)
930 scale_it = false;
931 else {
932 xf = GD_drawing(g)->size.x / sz.x;
933 yf = GD_drawing(g)->size.y / sz.y;
934 if (xf < 1.0 || yf < 1.0) {
935 if (xf < yf) {
936 yf /= xf;
937 xf = 1.0;
938 } else {
939 xf /= yf;
940 yf = 1.0;
941 }
942 }
943 }
944 } else if (GD_drawing(g)->ratio_kind == R_EXPAND) {
945 if (GD_drawing(g)->size.x <= 0)
946 scale_it = false;
947 else {
948 xf = GD_drawing(g)->size.x / GD_bb(g).UR.x;
949 yf = GD_drawing(g)->size.y / GD_bb(g).UR.y;
950 if (xf > 1.0 && yf > 1.0) {
951 const double scale = fmin(xf, yf);
952 xf = yf = scale;
953 } else
954 scale_it = false;
955 }
956 } else if (GD_drawing(g)->ratio_kind == R_VALUE) {
957 desired = GD_drawing(g)->ratio;
958 actual = sz.y / sz.x;
959 if (actual < desired) {
960 yf = desired / actual;
961 xf = 1.0;
962 } else {
963 xf = actual / desired;
964 yf = 1.0;
965 }
966 } else
967 scale_it = false;
968 if (scale_it) {
969 if (GD_flip(g)) {
970 double t = xf;
971 xf = yf;
972 yf = t;
973 }
974 for (n = GD_nlist(g); n; n = ND_next(n)) {
975 ND_coord(n).x = round(ND_coord(n).x * xf);
976 ND_coord(n).y = round(ND_coord(n).y * yf);
977 }
978 scale_bb(g, g, xf, yf);
979 }
980 }
981}
982
983/* make space for the leaf nodes of each rank */
984static void make_leafslots(graph_t * g)
985{
986 int i, j, r;
987 node_t *v;
988
989 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
990 j = 0;
991 for (i = 0; i < GD_rank(g)[r].n; i++) {
992 v = GD_rank(g)[r].v[i];
993 ND_order(v) = j;
994 if (ND_ranktype(v) == LEAFSET)
995 j = j + ND_UF_size(v);
996 else
997 j++;
998 }
999 if (j <= GD_rank(g)[r].n)
1000 continue;
1001 node_t **new_v = gv_calloc(j + 1, sizeof(node_t*));
1002 for (i = GD_rank(g)[r].n - 1; i >= 0; i--) {
1003 v = GD_rank(g)[r].v[i];
1004 new_v[ND_order(v)] = v;
1005 }
1006 GD_rank(g)[r].n = j;
1007 new_v[j] = NULL;
1008 free(GD_rank(g)[r].v);
1009 GD_rank(g)[r].v = new_v;
1010 }
1011}
1012
1014{
1015 return ED_head_port(e).defined == ED_head_port(f).defined
1016 && ((ED_head_port(e).p.x == ED_head_port(f).p.x &&
1017 ED_head_port(e).p.y == ED_head_port(f).p.y)
1018 || !ED_head_port(e).defined)
1019 && ((ED_tail_port(e).p.x == ED_tail_port(f).p.x &&
1020 ED_tail_port(e).p.y == ED_tail_port(f).p.y)
1021 || !ED_tail_port(e).defined);
1022}
1023
1024static void expand_leaves(graph_t * g)
1025{
1026 int i, d;
1027 node_t *n;
1028 edge_t *e, *f;
1029
1030 make_leafslots(g);
1031 for (n = GD_nlist(g); n; n = ND_next(n)) {
1032 if (ND_other(n).list)
1033 for (i = 0; (e = ND_other(n).list[i]); i++) {
1034 if ((d = ND_rank(aghead(e)) - ND_rank(aghead(e))) == 0)
1035 continue;
1036 f = ED_to_orig(e);
1037 if (!ports_eq(e, f)) {
1038 zapinlist(&(ND_other(n)), e);
1039 if (d == 1)
1040 fast_edge(e);
1041 /*else unitize(e); ### */
1042 i--;
1043 }
1044 }
1045 }
1046}
1047
1048/* Add left and right slacknodes to a cluster which
1049 * are used in the LP to constrain nodes not in g but
1050 * sharing its ranks to be to the left or right of g
1051 * by a specified amount.
1052 * The slacknodes ln and rn give the x position of the
1053 * left and right side of the cluster's bounding box. In
1054 * particular, any cluster labels on the left or right side
1055 * are inside.
1056 * If a cluster has a label, and we have rankdir!=LR, we make
1057 * sure the cluster is wide enough for the label. Note that
1058 * if the label is wider than the cluster, the nodes in the
1059 * cluster may not be centered.
1060 */
1061static void make_lrvn(graph_t * g)
1062{
1063 node_t *ln, *rn;
1064
1065 if (GD_ln(g))
1066 return;
1067 ln = virtual_node(dot_root(g));
1068 ND_node_type(ln) = SLACKNODE;
1069 rn = virtual_node(dot_root(g));
1070 ND_node_type(rn) = SLACKNODE;
1071
1072 if (GD_label(g) && g != dot_root(g) && !GD_flip(agroot(g))) {
1073 int w = MAX(GD_border(g)[BOTTOM_IX].x, GD_border(g)[TOP_IX].x);
1074 make_aux_edge(ln, rn, w, 0);
1075 }
1076
1077 GD_ln(g) = ln;
1078 GD_rn(g) = rn;
1079}
1080
1081/* make left and right bounding box virtual nodes ln and rn
1082 * constrain interior nodes
1083 */
1084static void contain_nodes(graph_t * g)
1085{
1086 int margin, r;
1087 node_t *ln, *rn, *v;
1088
1089 margin = late_int (g, G_margin, CL_OFFSET, 0);
1090 make_lrvn(g);
1091 ln = GD_ln(g);
1092 rn = GD_rn(g);
1093 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1094 if (GD_rank(g)[r].n == 0)
1095 continue;
1096 v = GD_rank(g)[r].v[0];
1097 if (v == NULL) {
1098 agerrorf("contain_nodes clust %s rank %d missing node\n",
1099 agnameof(g), r);
1100 continue;
1101 }
1102 make_aux_edge(ln, v,
1103 ND_lw(v) + margin + GD_border(g)[LEFT_IX].x, 0);
1104 v = GD_rank(g)[r].v[GD_rank(g)[r].n - 1];
1105 make_aux_edge(v, rn,
1106 ND_rw(v) + margin + GD_border(g)[RIGHT_IX].x, 0);
1107 }
1108}
1109
1110/* set g->drawing->size to a reasonable default.
1111 * returns a boolean to indicate if drawing is to
1112 * be scaled and filled */
1113static bool idealsize(graph_t * g, double minallowed)
1114{
1115 double xf, yf, f, R;
1116 pointf b, relpage, margin;
1117
1118 /* try for one page */
1119 relpage = GD_drawing(g)->page;
1120 if (relpage.x < 0.001 || relpage.y < 0.001)
1121 return false; /* no page was specified */
1122 margin = GD_drawing(g)->margin;
1123 relpage = sub_pointf(relpage, margin);
1124 relpage = sub_pointf(relpage, margin);
1125 b.x = GD_bb(g).UR.x;
1126 b.y = GD_bb(g).UR.y;
1127 xf = relpage.x / b.x;
1128 yf = relpage.y / b.y;
1129 if (xf >= 1.0 && yf >= 1.0)
1130 return false; /* fits on one page */
1131
1132 f = MIN(xf, yf);
1133 xf = yf = MAX(f, minallowed);
1134
1135 R = ceil(xf * b.x / relpage.x);
1136 xf = R * relpage.x / b.x;
1137 R = ceil(yf * b.y / relpage.y);
1138 yf = R * relpage.y / b.y;
1139 GD_drawing(g)->size.x = b.x * xf;
1140 GD_drawing(g)->size.y = b.y * yf;
1141 return true;
1142}
static agxbuf last
last message
Definition agerror.c:29
Memory allocation wrappers that exit on failure.
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 ROUND(f)
Definition arith.h:48
#define right(i)
Definition closest.c:77
int late_int(void *obj, attrsym_t *attr, int defaultValue, int minimum)
Definition utils.c:33
void dot_concentrate(graph_t *g)
Definition conc.c:205
#define BOTTOM_IX
Definition const.h:111
#define TOP_IX
Definition const.h:113
#define NORMAL
Definition const.h:24
#define CL_OFFSET
Definition const.h:151
#define EDGE_LABEL
Definition const.h:176
#define LEFT_IX
Definition const.h:114
#define SLACKNODE
Definition const.h:26
#define VIRTUAL
Definition const.h:25
#define LEAFSET
Definition const.h:39
#define RIGHT_IX
Definition const.h:112
Agraph_t * dot_root(void *p)
Definition dotinit.c:494
int flat_edges(Agraph_t *)
Definition flat.c:259
void zapinlist(elist *, Agedge_t *)
Definition fastgr.c:95
Agedge_t * fast_edge(Agedge_t *)
Definition fastgr.c:69
Agedge_t * find_fast_edge(Agnode_t *, Agnode_t *)
Definition fastgr.c:41
Agnode_t * virtual_node(Agraph_t *)
Definition fastgr.c:202
#define left
Definition dthdr.h:12
geometric functions (e.g. on points and boxes)
static pointf sub_pointf(pointf p, pointf q)
Definition geomprocs.h:72
static pointf scale(double c, pointf p)
Definition geomprocs.h:130
static pointf exch_xyf(pointf p)
Definition geomprocs.h:108
bool Concentrate
Definition globals.h:61
Agsym_t * G_margin
Definition globals.h:77
static double len(glCompPoint p)
Definition glutils.c:150
void free(void *)
node NULL
Definition grammar.y:149
int agnnodes(Agraph_t *g)
Definition graph.c:158
char * agget(void *obj, char *name)
Definition attr.c:442
#define ED_to_orig(e)
Definition types.h:598
#define ED_dist(e)
Definition types.h:602
#define ED_minlen(e)
Definition types.h:592
#define agtail(e)
Definition cgraph.h:889
#define ED_weight(e)
Definition types.h:603
#define aghead(e)
Definition cgraph.h:890
#define ED_head_port(e)
Definition types.h:588
#define ED_label(e)
Definition types.h:589
#define ED_tail_port(e)
Definition types.h:597
void agerrorf(const char *fmt,...)
Definition agerror.c:165
#define GD_minrank(g)
Definition types.h:384
#define GD_maxrank(g)
Definition types.h:382
#define GD_drawing(g)
Definition types.h:353
#define GD_border(g)
Definition types.h:359
#define GD_has_labels(g)
Definition types.h:368
#define GD_clust(g)
Definition types.h:360
#define GD_rn(g)
Definition types.h:398
#define GD_rank(g)
Definition types.h:395
#define GD_bb(g)
Definition types.h:354
#define GD_nlist(g)
Definition types.h:393
#define GD_n_cluster(g)
Definition types.h:389
#define GD_ht2(g)
Definition types.h:372
#define GD_label(g)
Definition types.h:374
#define GD_nodesep(g)
Definition types.h:394
#define GD_ln(g)
Definition types.h:381
#define GD_ht1(g)
Definition types.h:371
#define GD_flip(g)
Definition types.h:378
#define GD_exact_ranksep(g)
Definition types.h:363
#define GD_ranksep(g)
Definition types.h:397
#define ND_rank(n)
Definition types.h:523
#define ND_prev(n)
Definition types.h:521
#define ND_ht(n)
Definition types.h:500
#define ND_next(n)
Definition types.h:510
#define ND_clust(n)
Definition types.h:489
#define ND_other(n)
Definition types.h:514
#define ND_save_in(n)
Definition types.h:526
#define ND_alg(n)
Definition types.h:484
#define ND_flat_out(n)
Definition types.h:493
#define ND_rw(n)
Definition types.h:525
#define ND_node_type(n)
Definition types.h:511
#define ND_lw(n)
Definition types.h:506
#define ND_save_out(n)
Definition types.h:527
#define ND_mval(n)
Definition types.h:508
#define ND_order(n)
Definition types.h:513
#define ND_UF_size(n)
Definition types.h:487
#define ND_ranktype(n)
Definition types.h:524
#define ND_coord(n)
Definition types.h:490
#define ND_in(n)
Definition types.h:501
#define ND_out(n)
Definition types.h:515
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:158
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Definition cgraph.h:216
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
Definition obj.c:234
Agraph_t * agroot(void *obj)
Definition obj.c:167
@ AGOUTEDGE
Definition cgraph.h:207
@ AGINEDGE
Definition cgraph.h:207
Arithmetic helper functions.
static int scale_clamp(int original, double scale)
scale up or down a non-negative integer, clamping to [0, INT_MAX]
Definition gv_math.h:71
swig_ptr_object_handlers offset
Definition gv_php.cpp:5915
htmllabel_t * lbl
Definition htmlparse.c:93
void mark_lowclusters(Agraph_t *root)
Definition cluster.c:405
#define delta
Definition maze.c:133
int rank(graph_t *g, int balance, int maxiter)
Definition ns.c:997
static void set_ycoords(graph_t *g)
Definition position.c:728
static bool vnode_not_related_to(graph_t *g, node_t *v)
Definition position.c:368
static void separate_subclust(graph_t *g)
Definition position.c:452
static void contain_subclust(graph_t *g)
Definition position.c:429
static void set_aspect(graph_t *g)
Definition position.c:910
static void rec_bb(graph_t *g, graph_t *root)
Definition position.c:883
static void expand_leaves(graph_t *g)
Definition position.c:1024
void dot_position(graph_t *g)
Definition position.c:125
static void connectGraph(graph_t *g)
Definition position.c:77
static void compress_graph(graph_t *g)
Definition position.c:501
static bool idealsize(graph_t *g, double)
Definition position.c:1113
static void contain_clustnodes(graph_t *g)
Definition position.c:352
static void dot_compute_bb(graph_t *g, graph_t *root)
Definition position.c:836
static void make_lrvn(graph_t *g)
Definition position.c:1061
static void make_leafslots(graph_t *g)
Definition position.c:984
static bool canreach(node_t *u, node_t *v)
Definition position.c:172
static void set_xcoords(graph_t *g)
Set x coords of nodes.
Definition position.c:569
static bool go(node_t *u, node_t *v)
Definition position.c:159
static void adjustSimple(graph_t *g, double delta, int margin_total)
Definition position.c:594
static int nsiter2(graph_t *g)
Definition position.c:149
static double largeMinlen(double l)
Definition position.c:62
static int clust_ht(Agraph_t *g)
Definition position.c:680
static void remove_aux_edges(graph_t *g)
Definition position.c:534
static void contain_nodes(graph_t *g)
Definition position.c:1084
static void make_LR_constraints(graph_t *g)
Definition position.c:214
static void scale_bb(graph_t *g, graph_t *root, double xf, double yf)
Definition position.c:894
edge_t * make_aux_edge(node_t *u, node_t *v, double len, int wt)
Definition position.c:176
static void make_edge_pairs(graph_t *g)
make virtual edge pairs corresponding to input edges
Definition position.c:325
static void adjustRanks(graph_t *g, int margin_total)
Definition position.c:628
static void pos_clusters(graph_t *g)
Definition position.c:491
static void create_aux_edges(graph_t *g)
Definition position.c:525
static void allocate_aux_edges(graph_t *g)
Definition position.c:196
int ports_eq(edge_t *e, edge_t *f)
Definition position.c:1013
static void keepout_othernodes(graph_t *g)
Definition position.c:390
double selfRightSpace(edge_t *e)
Definition splines.c:1148
Agobj_t base
Definition cgraph.h:269
Agedge_t in
Definition cgraph.h:276
Agedge_t out
Definition cgraph.h:276
Agobj_t base
Definition cgraph.h:260
Agrec_t * data
stores programmer-defined data, access with AGDATA
Definition cgraph.h:212
graph or subgraph
Definition cgraph.h:425
Agraph_t * root
subgraphs - ancestors
Definition cgraph.h:434
Definition types.h:251
edge_t ** list
Definition types.h:252
size_t size
Definition types.h:253
double x
Definition geom.h:29
double y
Definition geom.h:29
node_t ** v
Definition types.h:202
int n
Definition types.h:201
#define free_list(L)
Definition types.h:272
#define alloc_elist(n, L)
Definition types.h:267
@ R_AUTO
Definition types.h:216
@ R_COMPRESS
Definition types.h:216
@ R_VALUE
Definition types.h:216
@ R_FILL
Definition types.h:216
@ R_EXPAND
Definition types.h:216
Definition grammar.c:93
#define MAX(a, b)
Definition write.c:31