From: Matthew Fernandez Date: Mon, 2 Jan 2023 00:32:21 +0000 (-0800) Subject: sparse mq_clustering: remove 'inplace' parameter X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70be0cac17d53d5cc79d2a05568edcf28668ffb2;p=graphviz sparse mq_clustering: remove 'inplace' parameter This is always set to false. --- diff --git a/lib/sparse/DotIO.c b/lib/sparse/DotIO.c index dc02da4d0..757cb8847 100644 --- a/lib/sparse/DotIO.c +++ b/lib/sparse/DotIO.c @@ -478,7 +478,7 @@ SparseMatrix Import_coord_clusters_from_dot(Agraph_t* g, int maxcluster, int dim if (!clust_sym) clust_sym = agattr(g,AGNODE,"cluster","-1"); if (clustering_scheme == CLUSTERING_MQ){ - mq_clustering(A, FALSE, maxcluster, use_value, + mq_clustering(A, maxcluster, use_value, &nc, clusters, &modularity); } else if (clustering_scheme == CLUSTERING_MODULARITY){ modularity_clustering(A, FALSE, maxcluster, use_value, @@ -665,7 +665,7 @@ void attached_clustering(Agraph_t* g, int maxcluster, int clustering_scheme){ if (!clust_sym) clust_sym = agattr(g,AGNODE,"cluster","-1"); if (clustering_scheme == CLUSTERING_MQ){ - mq_clustering(A, FALSE, maxcluster, use_value, + mq_clustering(A, maxcluster, use_value, &nc, &clusters, &modularity); } else if (clustering_scheme == CLUSTERING_MODULARITY){ modularity_clustering(A, FALSE, maxcluster, use_value, diff --git a/lib/sparse/mq.c b/lib/sparse/mq.c index b27326712..1b1303cac 100644 --- a/lib/sparse/mq.c +++ b/lib/sparse/mq.c @@ -589,11 +589,10 @@ static void hierachical_mq_clustering(SparseMatrix A, int maxcluster, -void mq_clustering(SparseMatrix A, int inplace, int maxcluster, int use_value, +void mq_clustering(SparseMatrix A, int maxcluster, int use_value, int *nclusters, int **assignment, double *mq){ /* find a clustering of vertices by maximize mq A: symmetric square matrix n x n. If real value, value will be used as edges weights, otherwise edge weights are considered as 1. - inplace: whether A can e modified. If true, A will be modified by removing diagonal. maxcluster: used to specify the maximum number of cluster desired, e.g., maxcluster=10 means that a maximum of 10 clusters . is desired. this may not always be realized, and mq may be low when this is specified. Default: maxcluster = 0 nclusters: on output the number of clusters @@ -605,7 +604,7 @@ void mq_clustering(SparseMatrix A, int inplace, int maxcluster, int use_value, B = SparseMatrix_symmetrize(A, false); - if (!inplace && B == A) { + if (B == A) { B = SparseMatrix_copy(A); } diff --git a/lib/sparse/mq.h b/lib/sparse/mq.h index da68d05bb..acc30ef57 100644 --- a/lib/sparse/mq.h +++ b/lib/sparse/mq.h @@ -46,7 +46,6 @@ struct Multilevel_MQ_Clustering_struct { /* find a clustering of vertices by maximize modularity quality A: symmetric square matrix n x n. If real value, value will be used as edges weights, otherwise edge weights are considered as 1. - inplace: whether A can e modified. If true, A will be modified by removing diagonal. maxcluster: used to specify the maximum number of cluster desired, e.g., maxcluster=10 means that a maximum of 10 clusters . is desired. this may not always be realized, and modularity quality may be low when this is specified. Default: maxcluster = 0 (no limit) @@ -57,7 +56,7 @@ struct Multilevel_MQ_Clustering_struct { . If *assignment = NULL on entry, it will be allocated. Otherwise used. mq: achieve modularity */ -void mq_clustering(SparseMatrix A, int inplace, int maxcluster, int use_value, +void mq_clustering(SparseMatrix A, int maxcluster, int use_value, int *nclusters, int **assignment, double *mq); #ifdef __cplusplus