Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

Head's Up! Site migration is underway. Phase 2: migrate recent content

find all shortest Paths between given source and target

Node Link

Hi there,

I am new to the graph data science library and am a bit unsure how to achieve the following goal. I have two biological entities (nodes) and i want the shortest path between them. If there are several paths of the same length i want all of them. To accomplish that I am projecting the graph to memory and then run the Dijkstra Source - Target shortest Path as a query as follows:


MATCH (source:Entity {name: 'tissues'}), (target:Entity {name: 'McArdle'})
CALL'Knowledge', {
sourceNode: source,
targetNode: target
YIELD index, sourceNode, targetNode, nodeIds, path
gds.util.asNode(sourceNode).name AS sourceNodeName,
gds.util.asNode(targetNode).name AS targetNodeName,
[nodeId IN nodeIds | gds.util.asNode(nodeId).name] AS nodeNames,
[x in nodes(path) | properties(x)] AS pathProperties
ORDER BY index

This works fine for many cases, however I oftentimes have multiple paths between two nodes with the same length. I have attached an example in which 4 valid shortest paths exist between the node "tissues" and the node "exercise efficiency". I do want to find all of these shortest paths not only one of them with my query. Do i need to use another algorithm to achieve my goal or to alter my query?

Thanks for your help πŸ™‚