30 for (i =
GD_rank(g)[r].n; i > pos; i--) {
65 if (
ND_in(v).size == 0) {
66 assert(
ND_out(v).size == 2);
71 bounds[
SLB] = bounds[
HLB] = ord;
73 bounds[
SRB] = bounds[
HRB] = ord;
75 else if (l < lpos && r > rpos);
78 if (l < lpos || (l == lpos && r < rpos))
80 if (r > rpos || (r == rpos && l > lpos))
85 onleft = onright =
false;
86 for (i = 0; (f =
ND_out(v).list[i]); i++) {
96 if (onleft && !onright)
97 bounds[
HLB] = ord + 1;
98 if (onright && !onleft)
99 bounds[
HRB] = ord - 1;
106 int lnode, rnode, r, bounds[4], lpos, rpos, pos;
113 bounds[
HLB] = bounds[
SLB] = lnode - 1;
114 bounds[
HRB] = bounds[
SRB] = rnode + 1;
116 while (lnode <= rnode) {
122 if (bounds[
HRB] - bounds[
HLB] <= 1)
125 if (bounds[
HLB] <= bounds[
HRB])
126 pos = (bounds[
HLB] + bounds[
HRB] + 1) / 2;
128 pos = (bounds[
SLB] + bounds[
SRB] + 1) / 2;
154 if ((n =
GD_rank(g)[r - 1].v[0]))
179 if (
GD_rank(g)[r - 1].ht1 < h2)
181 if (
GD_rank(g)[r - 1].ht2 < h2)
228 for (i = lo + 1; i < hi; i++) {
268 for (
size_t j = 0; (e =
ND_flat_out(n).list[j]); j++) {
272 for (
size_t j = 0; j <
ND_other(n).size; j++) {
281 for (i = 0; (n =
GD_rank(g)[0].v[i]); i++) {
282 for (
size_t j = 0; (e =
ND_flat_in(n).list[j]); j++) {
310 for (
size_t j = 0; j <
ND_other(n).size; j++) {
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
static void * gv_calloc(size_t nmemb, size_t size)
Agraph_t * dot_root(void *p)
Agedge_t * virtual_edge(Agnode_t *, Agnode_t *, Agedge_t *)
void checkLabelOrder(graph_t *g)
void rec_reset_vlists(Agraph_t *)
void rec_save_vlists(Agraph_t *)
Agnode_t * virtual_node(Agraph_t *)
static void flat_node(edge_t *e)
static int flat_limits(graph_t *g, edge_t *e)
int flat_edges(graph_t *g)
static void checkFlatAdjacent(edge_t *e)
static void abomination(graph_t *g)
static node_t * make_vn_slot(graph_t *g, int r, int pos)
static void findlr(node_t *u, node_t *v, int *lp, int *rp)
static void setbounds(node_t *v, int *bounds, int lpos, int rpos)
Arithmetic helper functions.
int rank(graph_t *g, int balance, int maxiter)