From c8298e899f0167d34bc9892a4d146e6428906ea5 Mon Sep 17 00:00:00 2001 From: Emden Gansner Date: Fri, 28 Oct 2016 11:04:06 -0400 Subject: [PATCH] Allow user to specify clustering algorithm in gvmap. --- cmd/gvmap/gvmap.1 | 3 +++ cmd/gvmap/gvmap.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/gvmap/gvmap.1 b/cmd/gvmap/gvmap.1 index f5f60922e..8ee954828 100644 --- a/cmd/gvmap/gvmap.1 +++ b/cmd/gvmap/gvmap.1 @@ -121,6 +121,9 @@ Indicates what level of points should be shown. By default, no points are shown. 2 : label points 3 : random/artificial points .TP +.BI \-Q +Use modularity quality for clustering rather than the default modularity clustering. +.TP .BI \-r " k" The number of random points k (integer) used to define sea and lake boundaries. If 0, auto assigned. By default v = 0 .TP diff --git a/cmd/gvmap/gvmap.c b/cmd/gvmap/gvmap.c index cabcb5a0c..d014a0667 100644 --- a/cmd/gvmap/gvmap.c +++ b/cmd/gvmap/gvmap.c @@ -103,6 +103,7 @@ typedef struct { real bbox_margin[2]; int whatout; int useClusters; + int clusterMethod; int plotedges; int color_scheme; real line_width; @@ -279,6 +280,7 @@ init(int argc, char **argv, params_t* pm) pm->shore_depth_tol = 0; pm->highlight_cluster = 0; pm->useClusters = 0; + pm->clusterMethod = CLUSTERING_MODULARITY; pm->plotedges = 0; pm->whatout = 0; pm->show_points = 0; @@ -304,7 +306,7 @@ init(int argc, char **argv, params_t* pm) pm->bbox_margin[0] = pm->bbox_margin[1] = 0; opterr = 0; - while ((c = getopt(argc, argv, ":evODko:m:s:r:p:c:C:l:b:g:t:a:h:z:d:")) != -1) { + while ((c = getopt(argc, argv, ":evODQko:m:s:r:p:c:C:l:b:g:t:a:h:z:d:")) != -1) { switch (c) { case 'm': if ((sscanf(optarg,"%lf",&s) > 0) && (s != 0)){ @@ -313,6 +315,9 @@ init(int argc, char **argv, params_t* pm) usage(cmd, 1); } break; + case 'Q': + pm->clusterMethod = CLUSTERING_MQ; + break; #if 0 case 'q': if ((sscanf(optarg,"%d",&r) > 0) && r >=0 && r <=OUT_PROCESSING){ @@ -703,7 +708,7 @@ static void mapFromGraph (Agraph_t* g, params_t* pm) initDotIO(g); graph = Import_coord_clusters_from_dot(g, pm->maxcluster, pm->dim, &n, &width, &x, &grouping, - &rgb_r, &rgb_g, &rgb_b, &fsz, &labels, pm->color_scheme, CLUSTERING_MODULARITY, pm->useClusters); + &rgb_r, &rgb_g, &rgb_b, &fsz, &labels, pm->color_scheme, pm->clusterMethod, pm->useClusters); makeMap (graph, n, x, width, grouping, labels, fsz, rgb_r, rgb_g, rgb_b, pm, g); } -- 2.40.0