Traversal¶
At a high level, traversal performs the following steps:
- Retrieve
start_kmost similar to thequeryusing vector search. - Find the nodes reachable from the
initial_root_ids. - Discover the
start_knodes and the neighbors of the initial roots as "depth 0" candidates. - Ask the strategy which nodes to visit next.
- If no more nodes to visit, exit and return the selected nodes.
- Record those nodes as selected and retrieve the top
adjacent_knodes reachable from them. - Discover the newly reachable nodes (updating depths as needed).
- Goto 4.
Traversal Methods¶
The graph_retriever package provides traverse and atraverse for performing traversals.
LangChain Graph Retriever¶
The langchain_graph_retriever package provides GraphRetriever, an implementation of LangChain's BaseRetriever which performs traversals.