Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-26-2021 11:39 AM
Is there a way for me to run the following query in a way that forces communities to contain a certain number of nodes?
CALL gds.louvain.stream('myGraph', { relationshipWeightProperty: 'Weight',
includeIntermediateCommunities: True})
YIELD nodeId, communityId, intermediateCommunityIds
RETURN gds.util.asNode(nodeId).productId AS id, communityId, intermediateCommunityIds
ORDER BY communityId ASC
03-29-2021 03:21 PM
No, you can't specify the number of nodes in Louvain - it partitions the graph to maximize modularity (basically how densely nodes are connected within a community vs between communities).
With Louvain, we recommend using a weight property (which you have!), and considering the intermediate communities (if they're smaller). Otherwise, you can try running Louvain again on particularly large communities from your first result, to break them down into smaller subsets.
Another option is to try a different community detection algorithm like label propagation, speaker listener label propagation (which is ideal for overlapping communities), or strongly connected components.
All the sessions of the conference are now available online