apoc.algo.cover
Syntax |
|
||
Description |
Returns all |
||
Input arguments |
Name |
Type |
Description |
|
|
The nodes to look for connected relationships on. |
|
Return arguments |
Name |
Type |
Description |
|
|
The relationships connected to the given nodes. |
Usage examples
The examples below demonstrate how to use Cypher and APOC to return all relationships connecting the given set of nodes.
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);
apoc.algo.cover
WITH COLLECT {
MATCH (person:Person)
WHERE person.name IN ["Keanu Reeves", "Carrie-Anne Moss"]
RETURN person
} AS people
CALL apoc.algo.cover(people)
YIELD rel
RETURN startNode(rel) AS startNode, rel, endNode(rel) AS endNode
Matching in Cypher
WITH COLLECT {
MATCH (person:Person)
WHERE person.name IN ["Keanu Reeves", "Carrie-Anne Moss"]
RETURN person
} AS people
UNWIND people AS person
MATCH (person)-[rel]->(otherPerson)
WHERE otherPerson IN people
RETURN person AS startNode, rel, otherPerson AS endNode
startNode | rel | endNode |
---|---|---|
(:Person {name: "Keanu Reeves", born: 1964}) |
[:KNOWS] |
(:Person {name: "Carrie-Anne Moss", born: 1967}) |