41 static boolean downcandidate(
node_t * v)
47 static boolean bothdowncandidates(
node_t * u,
node_t * v)
59 static boolean upcandidate(
node_t * v)
77 static void mergevirtual(
graph_t * g,
int r,
int lpos,
int rpos,
int dir)
85 for (i = lpos + 1; i <= rpos; i++) {
88 while ((e =
ND_out(right).list[0])) {
89 for (k = 0; (f =
ND_out(left).list[k]); k++)
94 while ((e0 =
ND_in(right).list[0])) {
102 while ((e =
ND_in(right).list[0])) {
103 for (k = 0; (f =
ND_in(left).list[k]); k++)
108 while ((e0 =
ND_out(right).list[0])) {
140 static void rebuild_vlists(
graph_t * g)
163 agerr(
AGERR,
"rebuiltd_vlists: rank lead %s not in order %d of rank %d\n",
170 for (i = 0; i <
GD_rank(g)[r].n; i++) {
199 int c, r, leftpos, rightpos;
205 for (r = 1;
GD_rank(g)[r + 1].n; r++) {
206 for (leftpos = 0; leftpos <
GD_rank(g)[r].n; leftpos++) {
207 left =
GD_rank(g)[r].v[leftpos];
208 if (downcandidate(left) ==
FALSE)
210 for (rightpos = leftpos + 1; rightpos <
GD_rank(g)[r].n;
212 right =
GD_rank(g)[r].v[rightpos];
213 if (bothdowncandidates(left, right) ==
FALSE)
216 if (rightpos - leftpos > 1)
217 mergevirtual(g, r, leftpos, rightpos - 1,
DOWN);
222 for (leftpos = 0; leftpos <
GD_rank(g)[r].n; leftpos++) {
223 left =
GD_rank(g)[r].v[leftpos];
224 if (upcandidate(left) ==
FALSE)
226 for (rightpos = leftpos + 1; rightpos <
GD_rank(g)[r].n;
228 right =
GD_rank(g)[r].v[rightpos];
229 if (bothupcandidates(left, right) ==
FALSE)
232 if (rightpos - leftpos > 1)
233 mergevirtual(g, r, leftpos, rightpos - 1,
UP);
238 agerr(
AGPREV,
"concentrate=true may not work correctly.\n");
int portcmp(port p0, port p1)
void delete_fast_node(Agraph_t *, Agnode_t *)
void dot_scan_ranks(graph_t *g)
int agerr(agerrlevel_t level, const char *fmt,...)
void delete_fast_edge(Agedge_t *)
CGRAPH_API int agcontains(Agraph_t *, void *)
CGRAPH_API Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
void dot_concentrate(graph_t *g)
Agedge_t * virtual_edge(Agnode_t *, Agnode_t *, Agedge_t *)
#define ED_conc_opp_flag(e)
CGRAPH_API Agnode_t * agtail(Agedge_t *e)
CGRAPH_API Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
CGRAPH_API Agnode_t * aghead(Agedge_t *e)
CGRAPH_API char * agnameof(void *)
void merge_oneway(Agedge_t *, Agedge_t *)
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
Agraph_t * dot_root(void *p)
CGRAPH_API Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)