Skip to main content

Shortest Path Requires From or To Parameter

Erroneous Code Example

This error occurs when you use a shortest path operation without providing either a from or to parameter.
QUERY findPath() =>
    path <- N<User>::ShortestPath()
    RETURN path

Solution

Add a from or to parameter to the shortest path operation.
QUERY findPath(startId: ID, endId: ID) =>
    path <- N<User>::ShortestPath(from: startId, to: endId)
    RETURN path