'Does the shortest path mining algorithm of Neo4j require the relationship between nodes to be in the same direction

enter image description here

Please take a look at the picture.

I wanted to use Yen's Algorithm Shortest Path from Neo4j Graph Data Science to dig the Shortest Path between A and F, but nothing came back.

The following code:

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

Does the relation between A and F need to be in the same direction.

If I just want to look at the shortest distance between A and F, regardless of the direction and weight of relation, what should I do.

Thank you for any help



Solution 1:[1]

On Neo4j 4.4 there is an option to use shortestPath, in which you can define the direction or use both directions like this:

MATCH (source:Location{name: ‘A’}), (target:Location{name: ‘F’})
p = shortestPath((source)-[*]-(target))
RETURN p

Solution 2:[2]

Try deleting the file at path 'C:\xampp\mysql\data\ibdata1' and restart xamp

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nimrod serok
Solution 2 Daniyal