dijkstra
Compute the shortest weighted path between two nodes in a graph. Returns total distance and the path as a node sequence.
Instructions
Find the shortest weighted path between two nodes (Dijkstra's algorithm).
Returns the total distance and the sequence of nodes along the path.
Use this tool when: you need the shortest or cheapest path between two known nodes. Do NOT use this for: discovering important nodes (use pagerank) or finding similar content (use vector_search).
Args: source_id: Starting node ID. target_id: Destination node ID. weight_property: Edge property to use as weight (e.g. "distance", "cost"). If None every edge has weight 1.0.
Returns: JSON object with {distance, path: [{node_id, labels, properties}, ...]}. Returns an error message if the nodes are unreachable.
Error recovery: If the result is null/unreachable, check that both node IDs exist (use get_node) and that there is a connecting path in the graph.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source_id | Yes | ||
| target_id | Yes | ||
| weight_property | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |