Using the REST API in Neo4J 3.0.3 Community Edition, I am able to successfully see all paths between two nodes. I can find the shortest path if I specify the relationship type, but if I leave the relationship details (type, direction) off the request, I get back nothing. I would expect it to find the shortest path using any relationship type and direction. This works as expected in 2.2.3 both with and without the relationship details specified.
Interestingly, this works fine when there is more than one possible path.
Data looks like:
(675)-[341:friend]->(676)<-[342:friend]-(677)
HTTP POST to the URL:
http://localhost:7474/db/data/node/675/paths
with the following data:
{
"to":"http://localhost:7474/db/data/node/677",
"algorithm":"allPaths",
"max_depth":5
}
Returns the following response:
[
{
"relationships": [
"http://localhost:7474/db/data/relationship/341",
"http://localhost:7474/db/data/relationship/342"
],
"nodes": [
"http://localhost:7474/db/data/node/675",
"http://localhost:7474/db/data/node/676",
"http://localhost:7474/db/data/node/677"
],
"directions": [
"->",
"<-"
],
"length": 2,
"start": "http://localhost:7474/db/data/node/675",
"end": "http://localhost:7474/db/data/node/677"
}
]
HTTP POST to the URL:
http://localhost:7474/db/data/node/675/paths
with the following data:
{
"to":"http://localhost:7474/db/data/node/677",
"algorithm":"shortestPath",
"max_depth":5
}
Returns the following response:
[]
Turns out the 'relationships' property must be specified, and the 'type' of relationship must be specified. The 'direction' can be left off, or can be one of ['all','in','out'].
HTTP POST to the URL:
http://localhost:7474/db/data/node/675/paths
with the following data:
{
"to":"http://localhost:7474/db/data/node/677",
"max_depth":5,
"relationships" : {
"type" : "friend",
"direction" : "all"
},
"algorithm":"shortestPath"
}
Returns the following response:
[
{
"relationships": [
"http://localhost:7474/db/data/relationship/341",
"http://localhost:7474/db/data/relationship/342"
],
"nodes": [
"http://localhost:7474/db/data/node/675",
"http://localhost:7474/db/data/node/676",
"http://localhost:7474/db/data/node/677"
],
"directions": [
"->",
"<-"
],
"length": 2,
"start": "http://localhost:7474/db/data/node/675",
"end": "http://localhost:7474/db/data/node/677"
}
]