#How do I return all nodes and their connected relationships (with properties) from the Movie DB exam

1 messages · Page 1 of 1 (latest)

candid oyster
#

Hi everyone 👋 I’m experimenting with the Neo4j Movie example database and have a basic Cypher question.

I’d like to run a query that returns:

All nodes in the graph

For each node (as a source), all connected nodes

Plus the relationship between them including any properties on both nodes and relationships

Right now, I know I can see nodes in Neo4j Browser using:

||MATCH (n) RETURN n LIMIT 25||

…but I’m not sure how Neo4j Browser chooses which relationships to show when I run this query.

How can I write a Cypher query that explicitly returns each node, its connected nodes, and the relationships (with properties) between them?

Thanks in advance for helping me understand how this visualization logic works! 🙏

Tags: cypher, data-models, visualization

crimson monolith
#

💡 Starter Answer

Great question and this is a common one when people start exploring the Neo4j and Movie DB dataset for the first time.

When you run:

MATCH (n) RETURN n LIMIT 25

Neo4j Browser automatically displays a sample of the graph visualization — it picks a subset of nodes and then expands connected relationships on demand. The relationships aren’t being filtered by Cypher — they’re just not all drawn visually until you click or expand a node.

If you want to explicitly return all nodes and their connected relationships (with properties), you can write something like:

MATCH (n)-[r]->(m)
RETURN n, r, m
LIMIT 100
This query:

Returns each node n

All relationships r from that node

And the connected node m

While also preserving all properties on both nodes and relationships

If you want both directions, you can use:

MATCH (n)-[r]-(m) RETURN n, r, m LIMIT 100