How to query all relationships of a node in neo4j?
To retrieve all relationships of a node, you can utilize Neo4j’s Cypher query language. Here are some examples of queries:
- Retrieve all outgoing relationships of a node.
MATCH (n)-[r]->()
WHERE ID(n) = <节点ID>
RETURN r
- Find all the incoming relationships of a node.
MATCH ()-[r]->(n)
WHERE ID(n) = <节点ID>
RETURN r
- Retrieve all relationships of a node, including both out-degree and in-degree.
MATCH (n)-[r]-()
WHERE ID(n) = <节点ID>
RETURN r
- Search for relationships of a specified type in the node.
MATCH (n)-[r:关系类型]->()
WHERE ID(n) = <节点ID>
RETURN r
Please note that the