24 for (i =
GD_rank(g)[r].n; i > pos; i--) {
59 if (
ND_in(v).size == 0) {
60 assert(
ND_out(v).size == 2);
65 bounds[
SLB] = bounds[
HLB] = ord;
67 bounds[
SRB] = bounds[
HRB] = ord;
69 else if ((l < lpos) && (r > rpos));
72 if ((l < lpos) || ((l == lpos) && (r < rpos)))
74 if ((r > rpos) || ((r == rpos) && (l > lpos)))
79 onleft = onright =
false;
80 for (i = 0; (f =
ND_out(v).list[i]); i++) {
90 if (onleft && !onright)
91 bounds[
HLB] = ord + 1;
92 if (onright && !onleft)
93 bounds[
HRB] = ord - 1;
100 int lnode, rnode, r, bounds[4], lpos, rpos, pos;
107 bounds[
HLB] = bounds[
SLB] = lnode - 1;
108 bounds[
HRB] = bounds[
SRB] = rnode + 1;
110 while (lnode <= rnode) {
116 if (bounds[
HRB] - bounds[
HLB] <= 1)
119 if (bounds[
HLB] <= bounds[
HRB])
120 pos = (bounds[
HLB] + bounds[
HRB] + 1) / 2;
122 pos = (bounds[
SLB] + bounds[
SRB] + 1) / 2;
149 if ((n =
GD_rank(g)[r - 1].v[0]))
176 if (
GD_rank(g)[r - 1].ht1 < h2)
178 if (
GD_rank(g)[r - 1].ht2 < h2)
226 for (i = lo + 1; i < hi; i++) {
267 for (
size_t j = 0; (e =
ND_flat_out(n).list[j]); j++) {
271 for (
size_t j = 0; j <
ND_other(n).size; j++) {
280 for (i = 0; (n =
GD_rank(g)[0].v[i]); i++) {
281 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)