Class SpectralClustering<U>
java.lang.Object
es.uam.eps.ir.relison.sna.community.detection.modularity.balanced.SpectralClustering<U>
- Type Parameters:
U
- Type of the users.
- All Implemented Interfaces:
CommunityDetectionAlgorithm<U>
- Direct Known Subclasses:
NormalizedCutSpectralClustering
,RatioCutSpectralClustering
public abstract class SpectralClustering<U> extends java.lang.Object implements CommunityDetectionAlgorithm<U>
Community detection algorithm for balanced communities.
Reference: R. Zafarani, M.A. Abassi, H. Liu. Social Media Mining: An Introduction. Chapter 6. 2014
-
Field Summary
Fields Modifier and Type Field Description private int
k
The number of clusters we want to find. -
Constructor Summary
Constructors Constructor Description SpectralClustering(int k)
Constructor. -
Method Summary
Modifier and Type Method Description Communities<U>
detectCommunities(Graph<U> graph)
Computes the communities for a certain graph.protected abstract cern.colt.matrix.DoubleMatrix2D
laplacian(cern.colt.matrix.DoubleMatrix2D degree, cern.colt.matrix.DoubleMatrix2D adjacency)
Computes the Laplacian matrix of a graph, given the degree and adjacency matrices.
-
Field Details
-
k
private final int kThe number of clusters we want to find.
-
-
Constructor Details
-
SpectralClustering
public SpectralClustering(int k)Constructor.- Parameters:
k
- The number of clusters we want to find
-
-
Method Details
-
detectCommunities
Description copied from interface:CommunityDetectionAlgorithm
Computes the communities for a certain graph.- Specified by:
detectCommunities
in interfaceCommunityDetectionAlgorithm<U>
- Parameters:
graph
- The full graph.- Returns:
- The communities if everything went OK, null if not.
-
laplacian
protected abstract cern.colt.matrix.DoubleMatrix2D laplacian(cern.colt.matrix.DoubleMatrix2D degree, cern.colt.matrix.DoubleMatrix2D adjacency)Computes the Laplacian matrix of a graph, given the degree and adjacency matrices.- Parameters:
degree
- the degree matrix of a graphadjacency
- the adjacency matrix of a graph.- Returns:
- the Laplacian matrix.
-