Reputation: 121
I have a graph with multiple nodes and edges that have a relation of (links_to) between them. Nodes represent web pages and edges a hyperlink. Pages have many links, inclusive reciprocal links.
Problem:
When I run the shortest path between A and C I'm getting a path that contains an invalid direction. Shortest path A-C
Instead of A->B->C I'm getting A<-B->C.
How can I get the shortest path in the right direction?
This is my query:
MATCH (home { Label:'/' }),(paris { Label:'/paris/2012/intervenants.php' }),
p = shortestPath((home)-[:links_to]-(paris))
RETURN p
https://i.sstatic.net/VHTQ3.png
Upvotes: 2
Views: 865
Reputation: 124
You have to add *
(for many relationships between nodes) and direction:
MATCH (home { Label:'/' }), (paris { Label:'/paris/2012/intervenants.php' }),
p = shortestPath((home)-[:links_to*]->(paris))
RETURN p
The good example of cypher query is in link.
Upvotes: 0