Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E627

For the complete documentation index optimized for AI agents, see llms.txt.

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
N::User {
    name: String,
}

E::Follows {
    From: User,
    To: User,
}

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
N::User {
    name: String,
}

E::Follows {
    From: User,
    To: User,
}