Traversal¶
At a high level, traversal performs the following steps:
- Retrieve
start_k
most similar to thequery
using vector search. - Find the nodes reachable from the
initial_root_ids
. - Discover the
start_k
nodes 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_k
nodes 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.