Overview
The Community Detection using Label Propagation (CDLP) algorithm identifies communities in networks by propagating labels through the graph structure. Each node starts with a unique label, and through iterative propagation, nodes adopt the most frequent label among their neighbors, naturally forming communities where densely connected nodes share the same label. CDLP serves as a powerful algorithm in scenarios such as:- Social network community detection
- Biological network module identification
- Web page clustering and topic detection
- Market segmentation analysis
- Fraud detection networks
Algorithm Details
CDLP initializes by assigning each node a unique label (typically its node ID). The algorithm then iteratively updates each node’s label to the most frequent label among its neighbors. During each iteration, nodes are processed in random order to avoid deterministic bias. The algorithm continues until labels stabilize (no changes occur) or a maximum number of iterations is reached. The final labels represent community assignments, where nodes sharing the same label belong to the same community. The algorithm’s strength lies in its ability to discover communities without requiring prior knowledge of the number of communities or their sizes. It runs in near-linear time and mimics epidemic contagion by spreading labels through the network.Performance
CDLP operates with a time complexity of O(m + n) per iteration, where:- n represents the total number of nodes
- m represents the total number of edges
Syntax
Parameters
The procedure accepts an optional configurationMap with the following parameters:
Return Values
The procedure returns a stream of records with the following fields:Examples
Let’s take this Social Network as an example:- Alice, Bob, Charlie, Diana, Grace, Henry
- Eve, Frank, Iris, Jack
- Any isolated nodes
Create the Graph
Example: Detect all communities in the network
Expected Results
Example: Detect communities with limited iterations
Example: Focus on specific node types
Example: Use only certain relationship types
Example: Combine node and relationship filtering
Example: Group communities together
Expected Results
Example: Find the largest communities
Frequently Asked Questions
What is the syntax for running CDLP?
What is the syntax for running CDLP?
Use
CALL algo.labelPropagation() YIELD node, communityId. Optionally pass a configuration map with nodeLabels, relationshipTypes, or maxIterations.How does CDLP differ from WCC?
How does CDLP differ from WCC?
WCC finds disconnected components (nodes unreachable from each other). CDLP detects densely connected communities within a connected graph by propagating labels iteratively.
Do I need to specify the number of communities in advance?
Do I need to specify the number of communities in advance?
No. CDLP automatically discovers communities without requiring prior knowledge of how many communities exist or their sizes.
What does maxIterations control?
What does maxIterations control?
It sets the maximum number of label propagation rounds. The default is 10. The algorithm may converge earlier if labels stabilize. Increase it for very large or complex graphs.
Are CDLP results deterministic?
Are CDLP results deterministic?
Results may vary slightly between runs because nodes are processed in random order during each iteration. The overall community structure should remain consistent for well-defined clusters.