Tono Kuriakose
Tono Kuriakose

Reputation: 886

How to list all the edges associated with a particular node in Neo4j

I want to use Cypher to get a list of all the relationships (incoming and outgoing) of a node.

For example, here we have 4 nodes and their associated relationships. I want to list all the relationships associated with the APT28 node.

enter image description here

Upvotes: 2

Views: 645

Answers (1)

cybersam
cybersam

Reputation: 66989

You don't provide enough information about your data model. So I will assume here that the node you are interested in has the label Foo and that the APT28 value is in the id property.

To get all of the APT28 node's outgoing and incoming relationships, simply use this query (notice that it uses an undirected relationship pattern):

MATCH (n:Foo {id: 'APT28'})-[r]-()
RETURN r

Upvotes: 1

Related Questions