cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Finding all disconnected subgraphs in a graph

As you can see on a figure, there are two kind of network. The first one on right hand is a main graph and another one is subgraph. My question is Are there any algorithms or techniques (cypher) that can query only the sub-graph?

1 ACCEPTED SOLUTION
4 REPLIES 4

Hello @natakorn.chanpetch

I think you should have a look at the Weakly Connected Components algorithm

Example: How to remove connected components less than x nodes?

Regards,
Cobra

thank you sir, it works very well for your example. I applied it a bit for solving my problem, but it not work well with a large of network (6xx nodes and 6xx relationships). By the way, I will read the wcc algorithm and understand it as fast a s possible. I hope it can tackle the problem.

I used the wcc algorithm's stream function to display each component (componentId) and set filtering by select only record that has the number of elements between 2 and 10 nodes. Moreover, a result was really good. Thank you again for helping me @Cobra

Nice, no problem, I'm happy to help