NodeNameType
- The class type for the graph's nodes@PublicationReference(author="Vincent D Blondel, Jean-Loup Guillaume, Renaud Lambiotte, Etienne Lefebvre", title="Fast unfolding of communities in large networks", type=Journal, year=2008, publication="Journal of Statistical Mechanics: Theory and Experiment") public class Louvain<NodeNameType> extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Louvain.LouvainHierarchy<NodeNameType>
The return type from running Louvain.
|
Constructor and Description |
---|
Louvain(DirectedNodeEdgeGraph<NodeNameType> graph)
Initializes the internal Louvain datatypes that store the necessaries to
run Louvain on the input graph.
|
Louvain(DirectedNodeEdgeGraph<NodeNameType> graph,
int maxNumPasses,
double minModularityGain)
Initializes the internal Louvain datatypes that store the necessaries to
run Louvain on the input graph.
|
Modifier and Type | Method and Description |
---|---|
void |
initialPartition(java.util.Map<NodeNameType,java.lang.Integer> initPart)
The input partition will serve as the initial partition for the graph
(replacing Louvain's default "each node to its own community"
partitioning).
|
double |
modularity()
Returns the modularity of the most recent partitioning of the graph
|
void |
setRandomSet(long seed)
Initialize the random number generator with the input seed.
|
Louvain.LouvainHierarchy<NodeNameType> |
solveCommunities()
Solves for community detection of the graph passed in during the
constructor.
|
public Louvain(DirectedNodeEdgeGraph<NodeNameType> graph)
graph
- The graph to execute community detection onpublic Louvain(DirectedNodeEdgeGraph<NodeNameType> graph, int maxNumPasses, double minModularityGain)
graph
- The graph to execute community detection onmaxNumPasses
- The maximum number of passes to iterate within each
level of the hierarchyminModularityGain
- The minimum the amount modularity must improve
on each iteration to continue iterating within each level of the
hierarchy.public void setRandomSet(long seed)
seed
- The seed for the random number generatorpublic void initialPartition(java.util.Map<NodeNameType,java.lang.Integer> initPart)
initPart
- The initial partitioning where the key is a node id and
the value is a community id. Not all nodes need be assigned.java.lang.IllegalArgumentException
- if an input key does not exist in the
graph.public double modularity()
public Louvain.LouvainHierarchy<NodeNameType> solveCommunities()