cancel
Showing results for 
Search instead for 
Did you mean: 

Louvain algorithm: visualising communities

sales
Node

I have run the Louvain algorithm on my work data. This created a number of communities as expected. It has created one very big community with many small communities of users/customers. I have tried to analyse different samples of communities to study their connectivity status/behaviour within the communities. To my surprise, although most of the communities showed users/customers(graphs) when I tried to visualise them using cypher queries as expected, some of them showed no results. Most of these communities that showed no results are with one user only with some with 50-100 users. I have managed to display a few customers by taking away the relationship and the second node out of the query that helped to display some 1 user communities but still there is a big number of these communities that does not return any results. Please see the query below for your reference.

MATCH (c:client)-[t:Owns_Account]

->(a:ccount)

WHERE gds.util.nodeProperty('my_graph', id(c), 'community') =11114499

RETURN c,t,a

I want to establish if this behaviour of the Louvain community is expected i.e having some sort of ghost communities with no actual members even though the Louvain algorithm seems to be showing these communities with certain numbers of users/customers. What can be done about it? Please advise. Thank you

2 REPLIES 2

You can probably use an optional match instead

MATCH (c:client)
WHERE gds.util.nodeProperty('my_graph', id(c), 'community') =11114499
optional match (c)-[t:Owns_Account]->(a:ccount)
RETURN c,t,a

also I'm not sure if that's the most efficient way to query that.

Might be easier to create a subgraph with GDS with that filter and then stream the nodes of that subgraph back.

We need more information. Where do you see ghost Louvain communities? How do you construct your projected graph to run Louvain on it? I am guessing you are using the mutate mode of Louvain?