Sure there is

MATCH path = shortestPath ( (a:Person {name: "Roger"}) -[:KNOWS*]- (b:Person 
{name:"Michael"})
RETURN nodes(path);

> Am 03.11.2015 um 01:46 schrieb Roger Collins <[email protected]>:
> 
> I'm trying to do a DFS on a directed graph.
> 
> I'm baffled by how many hours I've searched Google and Stack Overflow for 
> something that should be a very common use cases of a graph database that 
> uses adjacency lists for storage.
> 
> Is there a way using Cypher to check if node A is connected in any way to 
> node B, if so, how?
> 
> Is there any way, using a depth-first-search, to find the first matched path 
> between two nodes?  If A and B are connected (as above) I want to return a 
> collection of every node in between them on the first matched path (I've read 
> that neo4j uses DFS by default).  How is this done?
> 
> In pseudo-cypher:
> 
> MATCH (a)-->(n*)-->(b) RETURN n;
> 
> Thanks for any and all help!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to