Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
clustering.h
Go to the documentation of this file.
1
/*************************************************************************
2
* Copyright (c) 2011 AT&T Intellectual Property
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* https://www.eclipse.org/legal/epl-v10.html
7
*
8
* Contributors: Details at https://graphviz.org
9
*************************************************************************/
10
11
#pragma once
12
13
#include <stdbool.h>
14
15
#ifdef __cplusplus
16
extern
"C"
{
17
#endif
18
19
typedef
struct
Multilevel_Modularity_Clustering_struct
*
Multilevel_Modularity_Clustering
;
20
21
struct
Multilevel_Modularity_Clustering_struct
{
22
int
level
;
/* 0, 1, ... */
23
int
n
;
24
SparseMatrix
A
;
/* n x n matrix */
25
SparseMatrix
P
;
26
Multilevel_Modularity_Clustering
next
;
27
Multilevel_Modularity_Clustering
prev
;
28
bool
delete_top_level_A
;
29
int
*
matching
;
/* dimension n. matching[i] is the clustering assignment of node i */
30
double
modularity
;
31
double
deg_total
;
/* total edge weights, including self-edges */
32
double
*
deg
;
/* dimension n. deg[i] equal to the sum of edge weights connected to vertex i. I.e., sum of row i */
33
bool
agglomerate_regardless
;
37
};
38
39
enum
{
CLUSTERING_MODULARITY
= 0,
CLUSTERING_MQ
};
40
41
/* find a clustering of vertices by maximize modularity
42
A: symmetric square matrix n x n. If real value, value will be used as edges weights, otherwise edge weights are considered as 1.
43
inplace: whether A can e modified. If true, A will be modified by removing diagonal.
44
45
maxcluster: used to specify the maximum number of cluster desired, e.g., maxcluster=10 means that a maximum of 10 clusters
46
. is desired. this may not always be realized, and modularity may be low when this is specified. Default: maxcluster = 0 (no limit)
47
48
nclusters: on output the number of clusters
49
assignment: dimension n. Node i is assigned to cluster "assignment[i]". 0 <= assignment < nclusters.
50
. If *assignment = NULL on entry, it will be allocated. Otherwise used.
51
modularity: achieve modularity
52
*/
53
void
modularity_clustering
(
SparseMatrix
A
,
bool
inplace,
int
maxcluster,
54
int
*nclusters,
int
**assignment,
double
*modularity);
55
56
#ifdef __cplusplus
57
}
58
#endif
CLUSTERING_MODULARITY
@ CLUSTERING_MODULARITY
Definition
clustering.h:39
CLUSTERING_MQ
@ CLUSTERING_MQ
Definition
clustering.h:39
Multilevel_Modularity_Clustering
struct Multilevel_Modularity_Clustering_struct * Multilevel_Modularity_Clustering
Definition
clustering.h:19
modularity_clustering
void modularity_clustering(SparseMatrix A, bool inplace, int maxcluster, int *nclusters, int **assignment, double *modularity)
Definition
clustering.c:341
A
#define A(n, t)
Definition
expr.h:76
Multilevel_Modularity_Clustering_struct
Definition
clustering.h:21
Multilevel_Modularity_Clustering_struct::P
SparseMatrix P
Definition
clustering.h:25
Multilevel_Modularity_Clustering_struct::level
int level
Definition
clustering.h:22
Multilevel_Modularity_Clustering_struct::prev
Multilevel_Modularity_Clustering prev
Definition
clustering.h:27
Multilevel_Modularity_Clustering_struct::deg
double * deg
Definition
clustering.h:32
Multilevel_Modularity_Clustering_struct::n
int n
Definition
clustering.h:23
Multilevel_Modularity_Clustering_struct::A
SparseMatrix A
Definition
clustering.h:24
Multilevel_Modularity_Clustering_struct::matching
int * matching
Definition
clustering.h:29
Multilevel_Modularity_Clustering_struct::deg_total
double deg_total
Definition
clustering.h:31
Multilevel_Modularity_Clustering_struct::delete_top_level_A
bool delete_top_level_A
Definition
clustering.h:28
Multilevel_Modularity_Clustering_struct::agglomerate_regardless
bool agglomerate_regardless
Definition
clustering.h:33
Multilevel_Modularity_Clustering_struct::modularity
double modularity
Definition
clustering.h:30
Multilevel_Modularity_Clustering_struct::next
Multilevel_Modularity_Clustering next
Definition
clustering.h:26
SparseMatrix_struct
Definition
SparseMatrix.h:28
lib
sparse
clustering.h
Generated by
1.9.8