1

In the neo4j browser

MATCH (n)
RETURN n

shows all nodes with all relationships. How does one do this in memgraph lab?

I can display the relevant nodes with relationships:

MATCH links = (Projectlist)-[:references]-(Reflist)
RETURN links

this does not shows the nodes without relationships, only the ones with relationships. What am I missing? Currently I prefer to use memgraph lab & dashboard with the style editor as this makes the visualisation easier to show to others to understand the concept.

Dewald
  • 33
  • 5
  • That second query is searching for paths, so it will not return nodes that are not roots of such paths. In particular, it will not return nodes without adjacent edges. Does the first query not work for memgraphdb? – Burak Serdar Apr 13 '23 at 20:55

1 Answers1

0

If you want to return nodes that have or do not have relationships and the relationships that exist, the following query will do what you want :

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

The neo4j browser will by default execute an additional query to find relationships between nodes that are returned to the visualisation.

So for the following query

MATCH (n) RETURN n

The following query is immediately executed by the Neo4j browser after the first query returned results to the view :

MATCH (a)-[r]->(b) WHERE id(a) IN $existingNodeIds AND id(b) IN $newNodeIds RETURN r;

This Neo4j browser feature can be enabled/disabled in the browser settings.

enter image description here

I'm not sure if something similar exists in memgraph lab.

Christophe Willemsen
  • 19,399
  • 2
  • 29
  • 36