pub fn bfs_with_predecessors(
conn: &Connection,
seed_entity_ids: &[i64],
namespace: &str,
min_weight: f64,
max_hops: u32,
max_neighbors_per_hop: Option<usize>,
) -> Result<(EntityDepthMap, PredecessorMap), AppError>Expand description
BFS that also returns a predecessor map for path reconstruction.
Used by deep-research to reconstruct directed evidence chains from
discovered entities back to their seeds.
Returns (entity_depth, predecessor) where:
entity_depth: minimum depth of each reached entity (0 = seed).predecessor: the BFS tree edge that first reached each non-seed entity.
When max_neighbors_per_hop is Some(k), only the top-k unvisited
neighbours by weight DESC are followed at each entity expansion.
§Errors
Propagates AppError::Database (exit 10) on SQLite query failures.