Community detection on bipartite graph

Hi team,i'm currently working on a project where I need to perform community detection using the Louvain algorithm on a bipartite graph in Neo4j. The graph represents a relationship between users and products through the "ordered" relationship.

Nodes: Users, Products
Relationship: [:ORDERED]

While there are numerous examples and resources available for applying the Louvain algorithm on peer graph structures (e.g., users connected by a "follow" relationship), I'm facing some challenges adapting these resources to my specific use case.
I would greatly appreciate it if anyone could provide insights, examples, or tips on how to effectively implement the Louvain algorithm on a bipartite graph like the one described above. If you've worked on similar projects or have expertise in this area, your guidance would be invaluable.

Hi @ravitadela !

You're absolutely right! There's lots of cases related to applying Louvain to homogeneous graphs, because that's its best way to work, of course it can work with heterogeneous graphs but the results won't be always as expected. I imagine that the complexity to refactor the graph to this desired structure lies in the amount of relationships that a single User has with all their ordered products, mainly because there isn't an intermediate node to group them (like a Category node); nevertheless, I think you can create relationships between User nodes counting the times they share any Product (or calculating Similarity first to create this relationships), and then run Louvain with only User nodes and using as weight this count (or the similarity score inside a SIMILAR relationship). Does this make sense?

Hope this helps, all the best!

Thank you so much for the guidance! @luiseduardo .I followed the approach you suggested, and it worked. I was able to get communities, but now, I'm diving into understanding the insights provided by Louvain Modularity.

Given that I have around 100 communities with varying sizes, ranging from 2000 to 100 customers, I'm curious about the justification behind why these customers are grouped together. Could you shed some light on the insights derived from the Louvain Modularity results? Your expertise is immensely valuable, and I appreciate any guidance you can provide.

I'm glad it worked!

Louvain optmizes a function to create clusters of more densely connected nodes than a random grouping would have. So, what I would do is analyze a cluster and see what relationships are shared among the members of the community, firstly by querying with Cypher or analyzing in Bloom. And secondly, by generalyzing any rules that seem to govern these shared relationships, maybe some groups share some type of product more than another or a specific group of products. This is where the fun begins!

All the best!