From: yifanhu Date: Fri, 4 Sep 2009 14:35:04 +0000 (+0000) Subject: do not shrink after the first stage of overlap removal. This is so that if some set... X-Git-Tag: LAST_LIBGRAPH~32^2~1722 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=befefa4a80978e88a4c1308a173b34bec18d4c2f;p=graphviz do not shrink after the first stage of overlap removal. This is so that if some set -Goverlap_scaling=-1000, the first stage may found no overlap at all and even decide to shrink, which defeat the original intention of the user of setting a huge scaling factor to expand the layout --- diff --git a/lib/neatogen/overlap.c b/lib/neatogen/overlap.c index bfd64d044..1504bb5bd 100644 --- a/lib/neatogen/overlap.c +++ b/lib/neatogen/overlap.c @@ -273,7 +273,7 @@ void OverlapSmoother_delete(OverlapSmoother sm){ OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m, int dim, real lambda0, real *x, real *width, int include_original_graph, int neighborhood_only, - real *max_overlap, real *min_overlap){ + real *max_overlap, real *min_overlap, int shrink){ OverlapSmoother sm; int i, j, k, *iw, *jw, *id, *jd, jdiag; SparseMatrix B; @@ -324,7 +324,7 @@ OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m, ideal_distance_avoid_overlap(dim, sm->Lwd, x, width, (real*) (sm->Lwd->a), max_overlap, min_overlap); /* no overlap at all! */ - if (*max_overlap < 1){ + if (*max_overlap < 1 && shrink){ if (Verbose) fprintf(stderr," no overlap (overlap = %f), rescale to shrink\n", *max_overlap - 1); for (i = 0; i < dim*m; i++) { x[i] *= (*max_overlap); @@ -428,6 +428,7 @@ void remove_overlap(int dim, SparseMatrix A, int m, real *x, real *label_sizes, real avg_label_size; real max_overlap = 0, min_overlap = 999; int neighborhood_only = TRUE; + int shrink = 0; #ifdef TIME clock_t cpu; @@ -470,14 +471,14 @@ void remove_overlap(int dim, SparseMatrix A, int m, real *x, real *label_sizes, for (i = 0; i < ntry; i++){ if (Verbose) print_bounding_box(m, dim, x); sm = OverlapSmoother_new(A, m, dim, lambda, x, label_sizes, include_original_graph, neighborhood_only, - &max_overlap, &min_overlap); + &max_overlap, &min_overlap, shrink); if (Verbose) fprintf(stderr, "overlap removal neighbors only?= %d iter -- %d, overlap factor = %g underlap factor = %g\n", neighborhood_only, i, max_overlap - 1, min_overlap); if (max_overlap <= 1){ OverlapSmoother_delete(sm); if (neighborhood_only == FALSE){ break; } else { - neighborhood_only = FALSE; + neighborhood_only = FALSE; shrink = 1; continue; } } diff --git a/lib/neatogen/overlap.h b/lib/neatogen/overlap.h index 6ee548e98..e01845871 100644 --- a/lib/neatogen/overlap.h +++ b/lib/neatogen/overlap.h @@ -27,7 +27,7 @@ typedef StressMajorizationSmoother OverlapSmoother; void OverlapSmoother_delete(OverlapSmoother sm); OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m, int dim, real lambda0, real *x, real *width, int include_original_graph, int neighborhood_only, - real *max_overlap, real *min_overlap); + real *max_overlap, real *min_overlap, int shrink); void OverlapSmoother_smooth(OverlapSmoother sm, int dim, real *x);