apoc.algo.cover

Details

Syntax

apoc.algo.cover(nodes) :: (rel)

Description

Returns all RELATIONSHIP values connecting the given set of NODE values.

Input arguments

Name

Type

Description

nodes

ANY

The nodes to look for connected relationships on.

Return arguments

Name

Type

Description

rel

RELATIONSHIP

The relationships connected to the given nodes.

Usage examples

The examples in this section are based on the following sample graph:

CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967})
CREATE (TomH:Person {name:'Tom Hanks', born:1956})

CREATE (Keanu)-[:KNOWS]->(Carrie);
CREATE (Tom)-[:KNOWS]->(Carrie);
match (p:Person)
WHERE p.name IN ["Keanu Reeves", "Carrie-Anne Moss"]
with collect(id(p)) as nodes
CALL apoc.algo.cover(nodes)
YIELD rel
RETURN  startNode(rel), rel, endNode(rel);
Results
startNode(rel) rel endNode(rel)

(:Person {name: "Keanu Reeves", born: 1964})

[:KNOWS]

(:Person {name: "Carrie-Anne Moss", born: 1967})