| Constructor and Description | 
|---|
Clustering()
Generates an empty clustering 
 | 
Clustering(ArrayList<OrderedSet<Integer>> clusters)
Generates a clustering with the specified set of clusters. 
 | 
Clustering(int[] vertexDistribution)
Generates a clustering with the specified vertex distribution to clusters. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Clustering | 
copy()
Returns a copy of this clustering. 
 | 
OrderedSet<Integer> | 
get(int index)
Returns the cluster with the specified index of this clustering,
 represented as the set consisting of the indices
 of its vertices. 
 | 
ArrayList<OrderedSet<Integer>> | 
getClusters()
Returns a list of the clusters of this clustering. 
 | 
int | 
getNumberOfClusters()
Returns the number of clusters of this clustering. 
 | 
Clustering | 
merge(int i,
     int j)
Merges the clusters i and j of this clustering and returns the resulting clustering. 
 | 
double | 
modularity(int[][] adjacency,
          int edges,
          int[] deg)
Computes and returns the modularity of this clustering in an undirected graph. 
 | 
double | 
modularity(int[][] adjacency,
          int edges,
          int[] indeg,
          int[] outdeg)
Computes and returns the modularity of this clustering in a directed graph. 
 | 
String | 
toString()  | 
String | 
toString(Vertible[] vertices)
Returns a string representing this clustering of vertices. 
 | 
public Clustering()
public Clustering(int[] vertexDistribution)
vertexDistribution[i] = j means that vertex i is 
 in cluster j.vertexDistribution - encodes the distribution of the vertices to the clusterspublic Clustering(ArrayList<OrderedSet<Integer>> clusters)
clusters - disjoint sets of vertices representing the clusterspublic Clustering copy()
public int getNumberOfClusters()
public OrderedSet<Integer> get(int index)
index - index specifying the clusterpublic ArrayList<OrderedSet<Integer>> getClusters()
public double modularity(int[][] adjacency,
                         int edges,
                         int[] indeg,
                         int[] outdeg)
Q = (2m)-1 ∑i,j ( Aij - (2m)-1 kioutkjin )
where kiout and kiin are the outdegree and the indegree of vertex i, respectively. M. E. J. Newman (2010): Networks. An Introduction. Oxford University Press, Oxford New York, Eq. (7.69).adjacency - the adjacency matrix of the directed graphedges - the number of edges of the directed graphindeg - array of the the indegreesoutdeg - array of the outdegreespublic double modularity(int[][] adjacency,
                         int edges,
                         int[] deg)
Q = (2m)-1 ∑i,j ( Aij - (2m)-1 kikj )
where ki is the degree of vertex i. For more details see M. E. J. Newman (2010): Networks. An Introduction. Oxford University Press, Oxford New York, Eq. (7.69).adjacency - the adjacency matrix of the directed graphedges - the number of edges of the directed graphdeg - array of the the degreespublic Clustering merge(int i, int j)
i - index of the first clusterj - index of the second clusterpublic String toString(Vertible[] vertices)
vertices - an array of the vertices of this clustering