28 for (i =
GD_rank(g)[r].n; i > pos; i--) {
63 if (
ND_in(v).size == 0) {
64 assert(
ND_out(v).size == 2);
69 bounds[
SLB] = bounds[
HLB] = ord;
71 bounds[
SRB] = bounds[
HRB] = ord;
73 else if (l < lpos && r > rpos);
76 if (l < lpos || (l == lpos && r < rpos))
78 if (r > rpos || (r == rpos && l > lpos))
83 onleft = onright =
false;
84 for (i = 0; (f =
ND_out(v).list[i]); i++) {
94 if (onleft && !onright)
95 bounds[
HLB] = ord + 1;
96 if (onright && !onleft)
97 bounds[
HRB] = ord - 1;
104 int lnode, rnode, r, bounds[4], lpos, rpos, pos;
111 bounds[
HLB] = bounds[
SLB] = lnode - 1;
112 bounds[
HRB] = bounds[
SRB] = rnode + 1;
114 while (lnode <= rnode) {
120 if (bounds[
HRB] - bounds[
HLB] <= 1)
123 if (bounds[
HLB] <= bounds[
HRB])
124 pos = (bounds[
HLB] + bounds[
HRB] + 1) / 2;
126 pos = (bounds[
SLB] + bounds[
SRB] + 1) / 2;
152 if ((n =
GD_rank(g)[r - 1].v[0]))
177 if (
GD_rank(g)[r - 1].ht1 < h2)
179 if (
GD_rank(g)[r - 1].ht2 < h2)
226 for (i = lo + 1; i < hi; i++) {
266 for (
size_t j = 0; (e =
ND_flat_out(n).list[j]); j++) {
270 for (
size_t j = 0; j <
ND_other(n).size; j++) {
279 for (i = 0; (n =
GD_rank(g)[0].v[i]); i++) {
280 for (
size_t j = 0; (e =
ND_flat_in(n).list[j]); j++) {
308 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)