How to view all nodes along with all their relationships in AGE Viewer?

Advertisements

I have a graph for cities with 6 cities, and only two of them have a relationship between them. I would like to write a query that gives me all the cities along with all the relationships in between them.

MATCH (n) RETURN n

The query above only gives me the nodes and not the relationships.
If I would like to have all the nodes along with all the relationships, what query may I use?

>Solution :

You can use the following query:

MATCH (n)
OPTIONAL MATCH (n)-[r]->(m)
RETURN n, r, m

This query will return all nodes (represented by n) and their relationships (represented by r and m). If a node doesn’t have any relationships, it will still be included in the results.

Leave a ReplyCancel reply