Class LabelPropagation<U>
java.lang.Object
es.uam.eps.ir.relison.sna.community.detection.modularity.LabelPropagation<U>
- Type Parameters:
U
- type of the users.
- All Implemented Interfaces:
CommunityDetectionAlgorithm<U>
public class LabelPropagation<U> extends java.lang.Object implements CommunityDetectionAlgorithm<U>
Implementation of the label propagation algorithm. This community detection approach starts with all nodes
having different communities, and ends when each nodes shares the same label that the majority of his neighbors.
Reference: U.N. Raghavan, R. Albert, S. Kumara. Near linear time algorithm to detect communities in large-scale networks. Physical Review E 76: 036106 (2007).
-
Field Summary
Fields Modifier and Type Field Description private int
rngSeed
The seed for a random number generator. -
Constructor Summary
Constructors Constructor Description LabelPropagation()
Constructor.LabelPropagation(int rngSeed)
Constructor. -
Method Summary
Modifier and Type Method Description Communities<U>
detectCommunities(Graph<U> graph)
Computes the communities for a certain graph.
-
Field Details
-
rngSeed
private final int rngSeedThe seed for a random number generator.
-
-
Constructor Details
-
LabelPropagation
public LabelPropagation()Constructor. -
LabelPropagation
public LabelPropagation(int rngSeed)Constructor.- Parameters:
rngSeed
- a seed for a random number generator.
-
-
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.
-