Fix graph truncation logic for depth-limited traversals
• Only set truncated flag for node limit • Keep depth limit info logging • Improve log message clarity • Fix false truncation detection
This commit is contained in:
parent
ac26f3a2f2
commit
f99c4a3738
1 changed files with 2 additions and 2 deletions
|
|
@ -402,14 +402,14 @@ class NetworkXStorage(BaseGraphStorage):
|
|||
|
||||
# Check if graph is truncated - either due to max_nodes limit or depth limit
|
||||
if (queue and len(bfs_nodes) >= max_nodes) or has_unexplored_neighbors:
|
||||
result.is_truncated = True
|
||||
if len(bfs_nodes) >= max_nodes:
|
||||
result.is_truncated = True
|
||||
logger.info(
|
||||
f"[{self.workspace}] Graph truncated: max_nodes limit {max_nodes} reached"
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
f"[{self.workspace}] Graph truncated: only {len(bfs_nodes)} nodes found within max_depth {max_depth}"
|
||||
f"[{self.workspace}] Graph truncated: found {len(bfs_nodes)} nodes within max_depth {max_depth}"
|
||||
)
|
||||
|
||||
# Create subgraph with BFS discovered nodes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue