Find shortest path(s) between two SPOKE nodes
find_pathFind paths connecting two entities in the SPOKE biomedical knowledge graph, returning ordered nodes and relationship types to reveal how they link.
Instructions
Find the shortest connecting path(s) between two entities in SPOKE - the right tool for "how are X and Y connected / what links X to Y / shortest path" and subgraph-bridge questions. Both endpoints are resolved first (case / apostrophe / id safe), then a bounded bidirectional allShortestPaths search runs (anchored, so it is fast and cannot scan the graph). Returns each path as an ordered list of nodes and the relationship types between them - so you can read off the intermediate nodes and mechanism in ONE call instead of probing many queries.
If no path is found within max_hops, that is reported (try a larger max_hops, or the entities are only distantly connected). Returns {source, target, max_hops, paths:[{hops, nodes:[...], rels:[...]}]}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Source entity name or identifier (e.g. 'APOE', 'aspirin', 'DOID:9256'). | |
| target | Yes | Target entity name or identifier. | |
| max_hops | No | Maximum path length to search (1-5; clamped). | |
| max_paths | No | Maximum number of shortest paths to return. | |
| source_label | No | Optional label for the source (e.g. 'Gene', 'Compound', 'Disease'). | |
| target_label | No | Optional label for the target. |