From: Matthew Fernandez Date: Sat, 28 May 2022 05:47:51 +0000 (-0700) Subject: gvmap: remove 'seed' parameter from 'map_palette_optimal_coloring' X-Git-Tag: 6.0.1~26^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2388893b26a5f47e2624dae5086ec6287c1a0651;p=graphviz gvmap: remove 'seed' parameter from 'map_palette_optimal_coloring' This is always passed as -10. --- diff --git a/cmd/gvmap/gvmap.c b/cmd/gvmap/gvmap.c index 0f2ed36b1..6872fc251 100644 --- a/cmd/gvmap/gvmap.c +++ b/cmd/gvmap/gvmap.c @@ -370,7 +370,7 @@ makeMap (SparseMatrix graph, int n, double* x, double* width, int* grouping, if (pm->color_optimize && country_graph && rgb_r && rgb_g && rgb_b) map_optimal_coloring(pm->seed, country_graph, rgb_r, rgb_g, rgb_b); else if (pm->color_scheme_str){ - map_palette_optimal_coloring(pm->color_scheme_str, country_graph, -10, + map_palette_optimal_coloring(pm->color_scheme_str, country_graph, &rgb_r, &rgb_g, &rgb_b); } diff --git a/cmd/gvmap/make_map.c b/cmd/gvmap/make_map.c index 262b2368c..4e8316556 100644 --- a/cmd/gvmap/make_map.c +++ b/cmd/gvmap/make_map.c @@ -28,7 +28,7 @@ #include #include -void map_palette_optimal_coloring(char *color_scheme, SparseMatrix A0, int seed, +void map_palette_optimal_coloring(char *color_scheme, SparseMatrix A0, float **rgb_r, float **rgb_g, float **rgb_b){ /* for a graph A, get a distinctive color of its nodes so that the color distanmce among all nodes are maximized. Here @@ -36,7 +36,6 @@ void map_palette_optimal_coloring(char *color_scheme, SparseMatrix A0, int seed, color_scheme: rgb, gray, lab, or one of the color palettes in color_palettes.h, or a list of hex rgb colors separaterd by comma like "#ff0000,#00ff00" A: the graph of n nodes cdim: dimension of the color space - seed: random_seed. If negative, consider -seed as the number of random start iterations rgb_r, rgb_g, rgb_b: float array of length A->m + 1, which contains color for each country. 1-based */ @@ -66,6 +65,10 @@ void map_palette_optimal_coloring(char *color_scheme, SparseMatrix A0, int seed, // node, the optimal is with in "accuracy" of the true global optimal. const double accuracy = 0.01; + // seed: random_seed. If negative, consider -seed as the number of random + // start iterations + const int seed = -10; + node_distinct_coloring(color_scheme, lightness, weightedQ, A, accuracy, seed, &cdim, &colors); diff --git a/cmd/gvmap/make_map.h b/cmd/gvmap/make_map.h index 01ccfdc8d..478f016bb 100644 --- a/cmd/gvmap/make_map.h +++ b/cmd/gvmap/make_map.h @@ -28,7 +28,8 @@ void plot_dot_map(Agraph_t* gr, int n, int dim, double *x, SparseMatrix polys, const char* opacity, SparseMatrix A, FILE*); void map_optimal_coloring(int seed, SparseMatrix A, float *rgb_r, float *rgb_g, float *rgb_b); -void map_palette_optimal_coloring(char *color_scheme, SparseMatrix A, int seed, float **rgb_r, float **rgb_g, float **rgb_b); +void map_palette_optimal_coloring(char *color_scheme, SparseMatrix A, + float **rgb_r, float **rgb_g, float **rgb_b); enum {POLY_LINE_REAL_EDGE, POLY_LINE_NOT_REAL_EDGE}; #define neighbor(t, i, edim, elist) elist[(edim)*(t)+i]