2
votes

yes, like the title says, I have a social graph stored in neo4j, about 1 million nodes and 20million relationships, I want to get the the largest connected subgraph, so I can continue my work. now I write a program to do that, i use DFS() to find the largest connected subgraph.If it is tound ,I delete those not connected nodes. But it takes 3 hours.....So my question is :Is there a more effectient algorithm to find the largest connected subgraph? Any suggestions will be helpful~Thanks!

1
Would you be willing to share your DFS implementation for finding the maximal subgraphs? - JasonRDalton

1 Answers

0
votes

Try this one, it works fine for me:

START input=node:user(your lucene index)
MATCH path = input-[:YOUR_REL*1..]->m WHERE NOT(m-[:YOUR_REL]->())
RETURN path

and you may have a look at this find longest path