ALL_PATH (advance)
As SHORT_PATH, we can find out all paths between two nodes, using any or specific relationship.
ALL_PATH query - Let's find all paths between A and D. As you see, there are 15 possible paths between A and D. We should be careful while running ALL_PATH query, as it could result into costly computation.
S=>(city:A)-[#ALL_PATH *]->(city:D)
{
"path_count":15,
"paths":[
{
"edges":[
{
"rel":"BYROAD"
},
{
"rel":"BYROAD"
}
],
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"name":"D",
"label":"city"
}
]
},
{
"nodes":[
{
"label":"city",
"name":"A"
},
{
"name":"B",
"label":"city"
},
{
"name":"C",
"label":"city"
},
{
"label":"city",
"name":"D"
}
],
"edges":[
{
"rel":"BYROAD"
},
{
"rel":"BYROAD"
},
{
"rel":"BYROAD"
}
]
},
{
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"name":"C",
"label":"city"
},
{
"name":"D",
"label":"city"
}
],
"edges":[
{
"rel":"BYROAD"
},
{
"rel":"BYROAD"
},
{
"rel":"BYAIR"
}
]
},
{
"edges":[
{
"rel":"BYROAD"
},
{
"rel":"BYAIR"
}
],
"nodes":[
{
"name":"A",
"label":"city"
},
{
"name":"B",
"label":"city"
},
{
"label":"city",
"name":"D"
}
]
},
{
"edges":[
{
"rel":"BYROAD"
},
{
"rel":"BYAIR"
},
{
"rel":"BYROAD"
}
],
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"label":"city",
"name":"C"
},
{
"name":"D",
"label":"city"
}
]
},
{
"edges":[
{
"rel":"BYROAD"
},
{
"rel":"BYAIR"
},
{
"rel":"BYAIR"
}
],
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"label":"city",
"name":"C"
},
{
"label":"city",
"name":"D"
}
]
},
{
"nodes":[
{
"label":"city",
"name":"A"
},
{
"label":"city",
"name":"D"
}
],
"edges":[
{
"rel":"BYROAD"
}
]
},
{
"nodes":[
{
"label":"city",
"name":"A"
},
{
"label":"city",
"name":"B"
},
{
"name":"D",
"label":"city"
}
],
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYROAD"
}
]
},
{
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYROAD"
},
{
"rel":"BYROAD"
}
],
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"label":"city",
"name":"C"
},
{
"name":"D",
"label":"city"
}
]
},
{
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"label":"city",
"name":"C"
},
{
"label":"city",
"name":"D"
}
],
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYROAD"
},
{
"rel":"BYAIR"
}
]
},
{
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYAIR"
}
],
"nodes":[
{
"name":"A",
"label":"city"
},
{
"name":"B",
"label":"city"
},
{
"label":"city",
"name":"D"
}
]
},
{
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"B"
},
{
"name":"C",
"label":"city"
},
{
"name":"D",
"label":"city"
}
],
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYAIR"
},
{
"rel":"BYROAD"
}
]
},
{
"nodes":[
{
"label":"city",
"name":"A"
},
{
"name":"B",
"label":"city"
},
{
"label":"city",
"name":"C"
},
{
"name":"D",
"label":"city"
}
],
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYAIR"
},
{
"rel":"BYAIR"
}
]
},
{
"nodes":[
{
"name":"A",
"label":"city"
},
{
"name":"C",
"label":"city"
},
{
"label":"city",
"name":"D"
}
],
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYROAD"
}
]
},
{
"nodes":[
{
"name":"A",
"label":"city"
},
{
"label":"city",
"name":"C"
},
{
"name":"D",
"label":"city"
}
],
"edges":[
{
"rel":"BYAIR"
},
{
"rel":"BYAIR"
}
]
}
]
}