简体   繁体   中英

Neo4J: How do I check each disjoint subgraph in a Neo4J query?

After I query through my database using Neo4J, I get a bunch of disjoint subgraphs like 'islands of nodes'.

What I want though is to get the most recent node for each 'island' (I have date values on each node).

How do I go about doing that?

Firstly you need to calculate yours islands like you said. To di it yYou can check the neo4j-graph-algo with the procedure algo.unionFind : https://neo4j-contrib.github.io/neo4j-graph-algorithms/#_community_detection_connected_components

Then for each of your island , you have to order the nodes and take the first one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM