The Label Propagation algorithm is part of the production-quality algorithm, which means it is well tested and optimized for large graphs. We are going to test run the Label Propagation algorithm on the graph we studied in the Weakly connected components section. The Cypher code to create it is available at https://github.com/PacktPublishing/Hands-On-Graph-Analytics-with-Neo4j/ch7/test_graph.cql.
Let's create an undirected projected graph:
CALL gds.graph.create(
"projected_graph",
"Node",
{
LINKED_TO: {
type: "LINKED_TO",
orientation: "UNDIRECTED"
}
}
)
To execute the Label Propagation algorithm on this graph, we can use the following query:
CALL gds.labelPropagation.stream("projected_graph")
YIELD nodeId, communityId
RETURN gds.util.asNode(nodeId).name AS nodeName, communityId
ORDER BY communityId
Here are the results:
╒═...