pub fn get_neighbors_cached(
graph_file: &mut GraphFile,
node_id: NativeNodeId,
direction: Direction,
cache: &mut TraversalCache,
stats: &mut TraversalCacheStats,
) -> NativeResult<Vec<NativeNodeId>>Expand description
Get neighbors for a node with per-traversal caching.
This helper function checks the cache before falling through to
AdjacencyHelpers, reducing redundant I/O during traversals.
§Parameters
graph_file: Mutable borrow of the graph file for I/O operationsnode_id: The node whose neighbors we want to fetchdirection: Whether to get Outgoing or Incoming neighborscache: Mutable borrow of the per-traversal cachestats: Mutable borrow of statistics tracking (optional)
§Returns
An owned Vec<NativeNodeId> containing the neighbor node IDs.
Note: Returns an owned Vec (not a reference) to avoid borrow
checker lifetime issues. The clone is cheap for typical neighbor list sizes.
§Example
let mut cache = TraversalCache::new();
let mut stats = TraversalCacheStats::default();
let neighbors = get_neighbors_cached(
graph_file,
node_id,
Direction::Outgoing,
&mut cache,
&mut stats,
)?;