# How to find the shortest path?

Hi, I want to know how to compute shortest paths algorithms in my given below graph model.

I want to compute the graph from person to phone number

``````MATCH path=shortestPath((Node1:SYNTHETIC {person:1})-[*0..10]-(Node2:PHONE {number:xxx}))
RETURN path
``````

The above example will only find the shortest path up to 10 hops (the `[*0..10]` bit).

You can use the GDS pathfinding algorithms to search at greater depth, search for the n-shortest paths, or use different path finding algorithms.

An example of the syntax is:

``````MATCH (source:Location {name: 'A'}), (target:Location {name: 'F'})
CALL gds.shortestPath.dijkstra.stream('myGraph', {
sourceNode: source,
targetNode: target,
relationshipWeightProperty: 'cost'
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
RETURN
index,
gds.util.asNode(sourceNode).name AS sourceNodeName,
gds.util.asNode(targetNode).name AS targetNodeName,
totalCost,
[nodeId IN nodeIds | gds.util.asNode(nodeId).name] AS nodeNames,
costs,
nodes(path) as path
ORDER BY index
``````

It is not really obvious, what you are looking for...

May be I'm too used to talk to computer, but I know from them that you only get the right answer when you ask the right question. And I discovered it works with humans as the same :-)
So please, while thinking about the kind of answer you would like to get, what would be the right question?

Hi,

Can anyone run or explain the above cypher queries? I do not have the graph model.

From this link I took the queries. They are not very clear.