0

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?

William
  • 469
  • 1
  • 4
  • 5
  • Please provide an example of what you are currently trying. It will help users understand your problem. – timstermatic Dec 06 '17 at 13:42
  • I'll second @timstermatic. How does the island look? If the nodes of an island are easily distinguishable, e.g. all islands are in a separate collection or there are tuples, your question requires an arg max-style query as the one in https://stackoverflow.com/questions/47595890/getting-the-max-record-with-different-values-using-cypher – Gabor Szarnyas Dec 06 '17 at 14:21
  • Sorry if I wasn't clear. I can't really get into what it is, because it's confidential, for the company I work for. All I wanted to know is if theres a function that let's you iterate through these 'islands'. – William Dec 06 '17 at 17:04

1 Answers1

0

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.

logisima
  • 7,340
  • 1
  • 18
  • 31