query1: match p=shortestpath((a:A)-[e:E*1..3]->(b:B)) return p,size(e) AS steps
query2: match p=allshortestpaths((a:A)-[e:E*1..3]->(b:B)) return p,size(e) AS steps

I did some tests and they all got the same result, my expectation is that if there are multiple shortest paths between two points then only one is returned, obviously I misunderstood.
So, what topology should I use to test the difference between these two queries, and does neo4j support finding any shortest path?

Hi @czp, keep in mind that if you have multiple input records/rows, you will get a separate result from shortestPath() for each row, since Cypher operations operate per row.

With shortestPath() , your output rows should be <= the number of input rows (since rows, where no path exists, will be weeded out, and there should be at most one result per row).

With allShortestPaths() , your output rows may be greater than your input rows, depending on how many paths have the same length per input row.