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