Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-10-2020 03:11 AM
The math seems to be above my league
I tried:
MATCH (m1) WHERE m1.range[0] < m.range[0] AND m1.range[1] < m.range[1]
WITH m1, m
MATCH (m2) WHERE m2.range[0] > m1.range[0] AND m2.range[1] > m1.range[1]
WITH m1,m2,m
RETURN m1.name AS startPart, m2.name AS endPart
10-10-2020 11:31 AM
Hi,
I don't know how many nodes are there in the graph. If there are not too many, you can create a relationship between the nodes.
MATCH (m:MyNode)
WITH m MATCH (n:MyNode) WHERE (m <> n) AND (m.range[0] < n.range[0] AND m.range[1] < n.range[1])
MERGE (m)<-[:IS_IN_RANGE_OF]-(n)
You might need to look for apoc.periodic.iterate() if there are too many of them in order to avoid running out of memory.
When it's done, then you can use
MATCH (m:MyNode)<-[: IS_IN_RANGE_OF]-(n)
RETURN m, COLLECT(n) AS parts
The only thing you might need is to decide which is start and which is end.
My two cents.
Nghia Doan
All the sessions of the conference are now available online