Label propagation (LPA) finds nonoverlapping communities: groups of densely interconnected nodes with sparser links to other groups. Unlike a weakly connected component, which only requires nodes to be reachable when relationship direction is ignored, a community can reveal distinct clusters inside one connected network. section 7.4 section 7.7
It is useful after turning a bipartite dataset into a co-occurrence network. For example, tweets and hashtags can be projected into a hashtag network, then grouped to identify related hashtag themes for analysis. section 7.0 section 7.7
A practical Neo4j Graph Data Science workflow is:
- Run `gds.labelPropagation.mutate` on the in-memory graph, selecting `Tag` nodes and `CO_OCCURRENCE` relationships and saving a `community` property. section 7.4
- Write the mutated `community` property from the in-memory graph to the stored graph with `gds.graph.writeNodeProperties`. section 7.4
- Group tags by community, count their members, and inspect representative tags to interpret the largest clusters. section 7.4
- Treat repeated runs carefully: LPA is nondeterministic because node-label update order is randomly decided, so results can vary on the same data. section 7.4
Interpreting hashtag communities
A large detected community includes `#programming`, `#ml`, `#iotpl`, `#rstats`, `#cybersecurity`, and `#serverless`. Another community containing `#nlp` includes `#datascience`, `#ai`, `#machinelearning`, `#python`, and `#deeplearning`. Such member lists turn numeric community IDs into analyzable themes. section 7.4
Listing 7.16 Executing the label propagation algorithm on the hashtag co-occurrence network and storing the results to the in-memory graph
CALL gds.labelPropagation.mutate('tags',
{nodeLabels:['Tag'], relationshipTypes: ['CO_OCCURRENCE'],
mutateProperty:'community'})
YIELD communityCount, communityDistribution;
Use the runnable mutate query as a starting point for assigning community IDs to nodes in a projected hashtag co-occurrence graph. section 7.4
