2
votes

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

http://i.stack.imgur.com/VHTQ3.png

1

1 Answers

0
votes

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.