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
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) AS startNode, rel, endNode(rel) AS endNode;
Matching in Cypher
MATCH (person:Person)
WHERE person.name IN ["Keanu Reeves", "Carrie-Anne Moss"]
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}) |