From 0695b22b3b3d6fce0cc7891f5c40cd2be12ee96a Mon Sep 17 00:00:00 2001 From: north Date: Thu, 26 Jan 2006 14:27:26 +0000 Subject: [PATCH] Minor cleanup for previous patch to fix init_rank trouble. --- lib/dotgen/rank.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/dotgen/rank.c b/lib/dotgen/rank.c index bae2ac50d..0ad5272a1 100644 --- a/lib/dotgen/rank.c +++ b/lib/dotgen/rank.c @@ -356,20 +356,22 @@ minmax_edges(graph_t * g) return slen; } -static void +static int minmax_edges2(graph_t * g, point slen) { node_t *n; + edge_t *e = 0; if ((GD_maxset(g) == NULL) && (GD_minset(g) == NULL)) return; for (n = agfstnode(g); n; n = agnxtnode(g, n)) { if (n != UF_find(n)) continue; if ((ND_out(n).size == 0) && GD_maxset(g) && (n != GD_maxset(g))) - virtual_edge(n, GD_maxset(g), NULL)->u.minlen = slen.y; + e = virtual_edge(n, GD_maxset(g), NULL)->u.minlen = slen.y; if ((ND_in(n).size == 0) && GD_minset(g) && (n != GD_minset(g))) - virtual_edge(GD_minset(g), n, NULL)->u.minlen = slen.x; + e = virtual_edge(GD_minset(g), n, NULL)->u.minlen = slen.x; } + return (e != 0); } /* Run the network simplex algorithm on each component. */ @@ -464,8 +466,8 @@ void dot_rank(graph_t * g) p = minmax_edges(g); decompose(g, 0); acyclic(g); - minmax_edges2(g, p); - decompose(g, 0); + if (minmax_edges2(g, p)) + decompose(g, 0); #ifdef ALLOW_LEVELS if ((N_level = agfindattr(g->proto->n, "level"))) setRanks(g, N_level); -- 2.40.0