I'm using neo4j and I build a large graph that has a lot of subgraph. For example, in the pic below there are 4 subgraphs.
So how can I get 4 groups of nodes by cypher query?
I'm using neo4j 3.0
You can make use of Strongly connected components algorithm in the Graph data science library (GDS - https://github.com/neo4j/graph-data-science) for Neo4j. The documentation is available at - https://neo4j.com/docs/graph-data-science/current/algorithms/strongly-connected-components/ You can create a sub-graph using node projection or other methods are available in the docs and as the name suggests, the algorithm will create separate communities in your graph, by using strongly connected component logic (https://en.wikipedia.org/wiki/Strongly_connected_component), and you will have nodes separated out like you want.