This is always set to true.
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);
MAX_GRPS = nc;
if (noclusterinfo) {
- int use_value = TRUE;
double modularity;
if (!clust_sym) clust_sym = agattr(g,AGNODE,"cluster","-1");
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);
clusters = MALLOC(sizeof(int)*nnodes);
{
- int use_value = TRUE;
double modularity;
if (!clust_sym) clust_sym = agattr(g,AGNODE,"cluster","-1");
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);
-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.
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);
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