How can we modify the cypher query so that it can give all the connected graphs (means the set of nodes and relationships that are connected to each other directly or indirectly) as a result for the query.
OR
Can I use traversal framework for my requirement?
The use case is: I need to get all the connected graphs from neo4j and store their information as an "cluster" in other database.1 group of connected graph = 1 cluster. I need to separate the connected graphs and then store the aggregate of some of the properties of nodes/relations and store it in other db.
I am using REST to interact with neo4j db.
It won't be fast though.
A dedicated algorithm in Java will be much faster collecting that data.
Idea for Cypher (which probably has really bad complexity and doesn't yet work):
.
@michael, I've modified a bit your query. Now it works on my data. The variant I'm posting keeps only one element per connected component. This is convenient if one is not interested in having the actual member of the components but still wants to be able to retrieve the members of each component.
@manish, I know that it's late but, maybe, you could have stored the component representatives in your new database, rather than all their members.