31 for (i =
GD_rank(g)[r].n; i > pos; i--) {
66 if (
ND_in(v).size == 0) {
67 assert(
ND_out(v).size == 2);
72 bounds[
SLB] = bounds[
HLB] = ord;
74 bounds[
SRB] = bounds[
HRB] = ord;
76 else if (l < lpos && r > rpos);
79 if (l < lpos || (l == lpos && r < rpos))
81 if (r > rpos || (r == rpos && l > lpos))
86 onleft = onright =
false;
87 for (i = 0; (f =
ND_out(v).list[i]); i++) {
97 if (onleft && !onright)
98 bounds[
HLB] = ord + 1;
99 if (onright && !onleft)
100 bounds[
HRB] = ord - 1;
107 int lnode, rnode, 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;
153 if ((n =
GD_rank(g)[r - 1].v[0]))
178 if (
GD_rank(g)[r - 1].ht1 < h2)
180 if (
GD_rank(g)[r - 1].ht2 < h2)
228 for (i = lo + 1; i < hi; i++) {
265 for (
size_t j = 0; (e =
ND_flat_out(n).list[j]); j++) {
269 for (
size_t j = 0; j <
ND_other(n).size; j++) {
279 for (
size_t i = 0; !found && (n =
GD_rank(g)[0].v[i]); i++) {
280 for (
size_t j = 0; !found && (e =
ND_flat_in(n).list[j]); j++) {
286 for (
size_t j = 0; !found && j <
ND_other(n).size; j++) {
301 for (
size_t i = 0; (e =
ND_flat_out(n).list[i]); i++) {
313 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)