An interesting feature of the GDS is its ability to store the communities at intermediate steps of the algorithm. This option needs to be enabled by setting the configuration parameter includeIntermediateCommunities to true. For instance, the following query will stream the results of the Louvain algorithm for our projected graph, returning an extra column containing the list of communities each node was assigned to at each iteration:
CALL gds.louvain.stream(
"projected_graph_single",
{
includeIntermediateCommunities: true
}
)
YIELD nodeId, communityId, intermediateCommunityIds
RETURN gds.util.asNode(nodeId).name as name, communityId, intermediateCommunityIds
ORDER BY name
In the case of our simple graph, the intermediateCommunityIds column contains a list with a single element corresponding to the final community. This means that one single iteration was sufficient to converge, which is not surprising given the very small size of the graph. When...