]> granicus.if.org Git - graphviz/commitdiff
sparse modularity_clustering: remove 'use_value' parameter
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 2 Jan 2023 00:36:45 +0000 (16:36 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 3 Jan 2023 02:57:45 +0000 (18:57 -0800)
This is always set to true.

lib/mingle/edge_bundling.cpp
lib/sparse/DotIO.c
lib/sparse/clustering.c
lib/sparse/clustering.h

index 1003d1105a217d978eacd2912c8adb87e9f4ea53..9d11096c4d5a081846c13ffb5c689984ff84ee35 100644 (file)
@@ -498,14 +498,13 @@ static pedge* modularity_ink_bundling(int dim, int ne, SparseMatrix B, pedge* ed
   double ink0, ink1;
   pedge e;
   int i, j, jj;
-  int use_value_for_clustering = TRUE;
 
   SparseMatrix BB;
 
   /* B may contain negative entries */
   BB = SparseMatrix_copy(B);
   BB = SparseMatrix_apply_fun(BB, fabs);
-  modularity_clustering(BB, TRUE, 0, use_value_for_clustering, &nclusters, &assignment, &modularity);
+  modularity_clustering(BB, TRUE, 0, &nclusters, &assignment, &modularity);
   SparseMatrix_delete(BB);
 
   if (Verbose > 1) fprintf(stderr, "there are %d clusters, modularity = %f\n",nclusters, modularity);
index b1fb3f81c8f4531b000a1726639a97004e8d950d..c00ef07e7b3e9aaca13b4029370248f64509412c 100644 (file)
@@ -473,7 +473,6 @@ SparseMatrix Import_coord_clusters_from_dot(Agraph_t* g, int maxcluster, int dim
   MAX_GRPS = nc;
 
   if (noclusterinfo) {
-    int use_value = TRUE;
     double modularity;
     if (!clust_sym) clust_sym = agattr(g,AGNODE,"cluster","-1");
 
@@ -481,7 +480,7 @@ SparseMatrix Import_coord_clusters_from_dot(Agraph_t* g, int maxcluster, int dim
       mq_clustering(A, maxcluster,
                    &nc, clusters, &modularity);
     } else if (clustering_scheme == CLUSTERING_MODULARITY){ 
-      modularity_clustering(A, FALSE, maxcluster, use_value,
+      modularity_clustering(A, FALSE, maxcluster,
                    &nc, clusters, &modularity);
     } else {
       assert(0);
@@ -660,7 +659,6 @@ void attached_clustering(Agraph_t* g, int maxcluster, int clustering_scheme){
   clusters = MALLOC(sizeof(int)*nnodes);
 
   {
-    int use_value = TRUE;
     double modularity;
     if (!clust_sym) clust_sym = agattr(g,AGNODE,"cluster","-1");
     
@@ -668,7 +666,7 @@ void attached_clustering(Agraph_t* g, int maxcluster, int clustering_scheme){
       mq_clustering(A, maxcluster,
                    &nc, &clusters, &modularity);
     } else if (clustering_scheme == CLUSTERING_MODULARITY){ 
-      modularity_clustering(A, FALSE, maxcluster, use_value,
+      modularity_clustering(A, FALSE, maxcluster,
                            &nc, &clusters, &modularity);
     } else {
       assert(0);
index ab9b2472f6344060316991496e0fd9ebb9880414..fd43ac0dea17fc45cc3d14acb2bc47ff87d05cad 100644 (file)
@@ -346,7 +346,7 @@ static void hierachical_modularity_clustering(SparseMatrix A, int ncluster_targe
 
 
 
-void modularity_clustering(SparseMatrix A, int inplace, int ncluster_target, int use_value,
+void modularity_clustering(SparseMatrix A, int inplace, int ncluster_target,
                           int *nclusters, int **assignment, double *modularity){
   /* find a clustering of vertices by maximize modularity
      A: symmetric square matrix n x n. If real value, value will be used as edges weights, otherwise edge weights are considered as 1.
@@ -373,7 +373,7 @@ void modularity_clustering(SparseMatrix A, int inplace, int ncluster_target, int
 
   B = SparseMatrix_remove_diagonal(B);
 
-  if (B->type != MATRIX_TYPE_REAL || !use_value) B = SparseMatrix_set_entries_to_real_one(B);
+  if (B->type != MATRIX_TYPE_REAL) B = SparseMatrix_set_entries_to_real_one(B);
 
   hierachical_modularity_clustering(B, ncluster_target, nclusters, assignment, modularity);
 
index 13e6b28e74eb1d392e71f304adeb25a5e3041b96..118d26d3d71957a7e4b01898fbb8fac272b20477 100644 (file)
@@ -45,13 +45,12 @@ enum {CLUSTERING_MODULARITY = 0, CLUSTERING_MQ};
    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 may be low when this is specified. Default: maxcluster = 0 (no limit)
 
-   use_value: whether to use the entry value, or treat edge weights as 1.
    nclusters: on output the number of clusters
    assignment: dimension n. Node i is assigned to cluster "assignment[i]". 0 <= assignment < nclusters.
    .   If *assignment = NULL on entry, it will be allocated. Otherwise used.
    modularity: achieve modularity
 */
-void modularity_clustering(SparseMatrix A, int inplace, int maxcluster, int use_value,
+void modularity_clustering(SparseMatrix A, int inplace, int maxcluster,
                           int *nclusters, int **assignment, double *modularity);
 
 #ifdef __cplusplus