Neo4j: how to execute a subgraph request

I want to select a subgraph (S) from my neo4j database and use another query on S to find out if the two given nodes are connected. Is there a way to write a query in neo4j? I am using node.js and Cypher. EDIT: I am doing something similar, for example:

Match (u:User)-[:adds]->(y:Paper)-[:consistsOf]->(e:L2)-[]->(m:L3)
where u.username = 'test'
MATCH p=(m:L3)-[r:gives*1..4]->(n:L3)
...

thank

+4
source share
1 answer

In your example, you can use the WITH clause to join two MATCH statements, for example, this is a bit cleared:

MATCH (u:User {username:'test'})-[:adds]->(y:Paper)-[:consistsOf]->(e:L2)-->(m:L3)
WITH m
MATCH p=(m)-[r:gives*1..4]->(n:L3)
...

WITH RETURN, , () . "m", MATCH "u", "y" "e".

+6

Source: https://habr.com/ru/post/1536376/


All Articles