If you want the shortest path to interpret the length of the path based on a cost function (for example shortest route on the map where the length of the roads is the cost), then the 'shortestPath()' function is not the right one. It can only consider all relationships as having the same weight and that is the nature of the optimization of that algorithm. You need a different algorithm like dijkstra or A-star. Cypher does not have integration to the graph-algo component that provides those algorithms, so you have three choices:
* Write an exhaustive cypher query that finds all paths, sums the cost and sorts and orders. This is fine on small graphs, but will be extremely slow on even medium sides graphs.
* Use the graph-algo module through the Java API (unmanaged extensions in neo4j 2.3 and earlier)
This last option is probably the easiest option, but I've not tried them myself. Michael might know better how well they work.