40#if defined(DEBUG) && DEBUG > 1
50 for (
size_t i = 0; i < el.
size; i++) {
65 "Edge length %f larger than maximum %d allowed.\nCheck for overwide "
68 return (
double)INT_MAX;
91 for (i = 0; i < rp->
n; i++) {
103 for (j = 0; (e =
ND_save_in(tp).list[j]); j++) {
112 if (found || !tp)
continue;
115 else hp = (rp-1)->v[0];
139 assert(rank_result == 0);
151 int maxiter = INT_MAX;
154 if ((
s =
agget(g,
"nslimit")))
165 for (i = 0; (e =
ND_out(u).list[i]); i++) {
205 for (i = 0;
ND_out(n).list[i]; i++);
206 for (j = 0;
ND_in(n).list[j]; j++);
237 nodesep = sep[i & 1];
238 for (j = 0; j <
rank[i].n; j++) {
251 for (
size_t k = 0; (e =
ND_other(u).list[k]); k++) {
258 v =
rank[i].v[j + 1];
402 for (i =
ND_order(v) - 1; i >= 0; i--) {
521 x =
MIN(x,USHRT_MAX);
537 node_t *n, *nnext, *nprev;
541 for (i = 0; (e =
ND_out(n).list[i]); i++) {
552 for (n =
GD_nlist(g); n; n = nnext) {
576 for (j = 0; j <
rank[i].n; j++) {
602 const double bottom = (
delta + 1) / 2;
603 const double delbottom =
GD_ht1(g) + bottom - (
rank[maxr].ht1 - margin_total);
605 for (r = maxr; r >= minr; r--) {
609 deltop =
GD_ht2(g) + (
delta-bottom) + delbottom - (
rank[minr].ht2 - margin_total);
614 for (r = minr-1; r >=
GD_minrank(root); r--) {
632 int maxr, minr, margin;
634 double delta, ht1, ht2;
649 ht1 = fmax(ht1,
GD_ht1(subg) + margin);
651 ht2 = fmax(ht2,
GD_ht2(subg) + margin);
662 delta = lht - (rht + ht1 + ht2);
686 int margin, haveClustLabel = 0;
724 return haveClustLabel;
731 double ht2, maxht,
delta, d0, d1;
742 for (i = 0; i <
rank[r].n; i++) {
751 for (j = 0; (e =
ND_other(n).list[j]); j++) {
754 ht2 = fmax(ht2,
ED_label(e)->dimen.y / 2);
759 if (
rank[r].pht2 < ht2)
761 if (
rank[r].pht1 < ht2)
785 delta = fmax(d0, d1);
790 fprintf(stderr,
"dot set_ycoords: rank %d is empty\n",
793 maxht = fmax(maxht,
delta);
810 maxht = fmax(maxht,
delta);
844 LL.
x = (double)INT_MAX;
845 UR.
x = (double)-INT_MAX;
910 double xf = 0.0, yf = 0.0, actual, desired;
920 bool scale_it =
true;
932 if (xf < 1.0 || yf < 1.0) {
948 if (xf > 1.0 && yf > 1.0) {
949 const double scale = fmin(xf, yf);
956 actual = sz.
y / sz.
x;
957 if (actual < desired) {
958 yf = desired / actual;
961 xf = actual / desired;
989 for (i = 0; i <
GD_rank(g)[r].n; i++) {
1000 for (i =
GD_rank(g)[r].n - 1; i >= 0; i--) {
1031 for (i = 0; (e =
ND_other(n).list[i]); i++) {
1096 agerrorf(
"contain_nodes clust %s rank %d missing node\n",
1113 double xf, yf, f, R;
1114 pointf b, relpage, margin;
1118 if (relpage.
x < 0.001 || relpage.
y < 0.001)
1125 xf = relpage.
x / b.
x;
1126 yf = relpage.
y / b.
y;
1127 if (xf >= 1.0 && yf >= 1.0)
1131 xf = yf =
MAX(f, minallowed);
1133 R = ceil(xf * b.
x / relpage.
x);
1134 xf = R * relpage.
x / b.
x;
1135 R = ceil(yf * b.
y / relpage.
y);
1136 yf = R * relpage.
y / b.
y;
static agxbuf last
last message
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
int late_int(void *obj, attrsym_t *attr, int defaultValue, int minimum)
void dot_concentrate(graph_t *g)
Agraph_t * dot_root(void *p)
int flat_edges(Agraph_t *)
void zapinlist(elist *, Agedge_t *)
Agedge_t * fast_edge(Agedge_t *)
Agedge_t * find_fast_edge(Agnode_t *, Agnode_t *)
Agnode_t * virtual_node(Agraph_t *)
geometric functions (e.g. on points and boxes)
static pointf sub_pointf(pointf p, pointf q)
static pointf scale(double c, pointf p)
static pointf exch_xyf(pointf p)
static double len(glCompPoint p)
int agnnodes(Agraph_t *g)
char * agget(void *obj, char *name)
void agerrorf(const char *fmt,...)
#define GD_exact_ranksep(g)
char * agnameof(void *)
returns a string descriptor for the object.
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
Agraph_t * agroot(void *obj)
Arithmetic helper functions.
static int scale_clamp(int original, double scale)
scale up or down a non-negative integer, clamping to [0, INT_MAX]
swig_ptr_object_handlers offset
void mark_lowclusters(Agraph_t *root)
int rank(graph_t *g, int balance, int maxiter)
static void set_ycoords(graph_t *g)
static bool vnode_not_related_to(graph_t *g, node_t *v)
static void separate_subclust(graph_t *g)
static void scale_bb(graph_t *g, double xf, double yf)
static void contain_subclust(graph_t *g)
static void set_aspect(graph_t *g)
static void rec_bb(graph_t *g, graph_t *root)
static void expand_leaves(graph_t *g)
void dot_position(graph_t *g)
static void connectGraph(graph_t *g)
static void compress_graph(graph_t *g)
static bool idealsize(graph_t *g, double)
static void contain_clustnodes(graph_t *g)
static void dot_compute_bb(graph_t *g, graph_t *root)
static void make_lrvn(graph_t *g)
static void make_leafslots(graph_t *g)
static bool canreach(node_t *u, node_t *v)
static void set_xcoords(graph_t *g)
Set x coords of nodes.
static bool go(node_t *u, node_t *v)
static void adjustSimple(graph_t *g, double delta, int margin_total)
static int nsiter2(graph_t *g)
static double largeMinlen(double l)
static int clust_ht(Agraph_t *g)
static void remove_aux_edges(graph_t *g)
static void contain_nodes(graph_t *g)
static void make_LR_constraints(graph_t *g)
edge_t * make_aux_edge(node_t *u, node_t *v, double len, int wt)
static void make_edge_pairs(graph_t *g)
make virtual edge pairs corresponding to input edges
static void adjustRanks(graph_t *g, int margin_total)
static void pos_clusters(graph_t *g)
static void create_aux_edges(graph_t *g)
static void allocate_aux_edges(graph_t *g)
int ports_eq(edge_t *e, edge_t *f)
static void keepout_othernodes(graph_t *g)
double selfRightSpace(edge_t *e)
Agrec_t * data
stores programmer-defined data, access with AGDATA
Agraph_t * root
subgraphs - ancestors
#define alloc_elist(n, L)