Class AbstractFastGreedy<U>
java.lang.Object
es.uam.eps.ir.relison.sna.community.detection.modularity.AbstractFastGreedy<U>
- Type Parameters:
U
- type of the users.
- All Implemented Interfaces:
CommunityDetectionAlgorithm<U>
,DendogramCommunityDetectionAlgorithm<U>
- Direct Known Subclasses:
FastGreedy
,SizeWeightedFastGreedy
public abstract class AbstractFastGreedy<U> extends java.lang.Object implements CommunityDetectionAlgorithm<U>, DendogramCommunityDetectionAlgorithm<U>
Abstract class for the implementation of Fast Greedy algorithm versions for optimizing modularity.
Reference: M.E.J. Newman. Fast Algorithm for detecting community structure in networks. Physical Review E 69(6): 066133 (2004)
-
Field Summary
Fields Modifier and Type Field Description private int
optimalNumComms
The optimal number of communities.protected java.util.Random
rng
Random number generator.private int
rngSeed
Random number seed. -
Constructor Summary
Constructors Constructor Description AbstractFastGreedy()
Constructor.AbstractFastGreedy(int rngSeed)
Constructor. -
Method Summary
Modifier and Type Method Description Communities<U>
detectCommunities(Graph<U> graph)
Computes the communities for a certain graph.Dendogram<U>
detectCommunityDendogram(Graph<U> graph)
Computes the community dendogram for a certain graph.protected abstract org.jooq.lambda.tuple.Tuple3<java.lang.Integer,java.lang.Integer,java.lang.Double>
findOptimalJoint(Graph<U> graph, Communities<U> comm)
Finds the optimal pair of communities to merge.
-
Field Details
-
optimalNumComms
private int optimalNumCommsThe optimal number of communities. -
rng
protected java.util.Random rngRandom number generator. -
rngSeed
private final int rngSeedRandom number seed.
-
-
Constructor Details
-
AbstractFastGreedy
public AbstractFastGreedy()Constructor. -
AbstractFastGreedy
public AbstractFastGreedy(int rngSeed)Constructor.- Parameters:
rngSeed
- the random seed.
-
-
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.
-
detectCommunityDendogram
Description copied from interface:DendogramCommunityDetectionAlgorithm
Computes the community dendogram for a certain graph.- Specified by:
detectCommunityDendogram
in interfaceDendogramCommunityDetectionAlgorithm<U>
- Parameters:
graph
- The full graph.- Returns:
- The dendogram if everything went OK, null if not.
-
findOptimalJoint
protected abstract org.jooq.lambda.tuple.Tuple3<java.lang.Integer,java.lang.Integer,java.lang.Double> findOptimalJoint(Graph<U> graph, Communities<U> comm)Finds the optimal pair of communities to merge.- Parameters:
graph
- the original graph.comm
- the communities.- Returns:
- A triple containing: a) the first comm. to merge, b) the second one, c) the mod. increment.
-