apoc.nodes.link
Procedure APOC Core
apoc.nodes.link([nodes],'REL_TYPE') - creates a linked list of nodes from first to last
Usage Examples
The examples in this section are based on the following sample graph:
CREATE (:Event {name: "Event 1", date: datetime("2019-06-01")})
CREATE (:Event {name: "Event 2", date: datetime("2019-06-04")})
CREATE (:Event {name: "Event 3", date: datetime("2019-06-08")});
We can create a linked list of these events, by running the following query:
MATCH (e:Event)
WITH e ORDER BY e.date
WITH collect(e) AS events
CALL apoc.nodes.link(events, "NEXT")
RETURN count(*);
Was this page helpful?