You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/python-sdk/guides/graph_traversal.mdx
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,8 @@ result = await client.traverse_paths(
84
84
85
85
:::
86
86
87
+
`shortest_paths_only` controls how many paths are considered through each intermediate node. When `True` (the server default), only the shortest path through each intermediate object is returned; when `False`, every loopless path up to `max_paths` is returned (exhaustive mode).
88
+
87
89
<TabsgroupId="async-sync">
88
90
<TabItemvalue="Async"default>
89
91
@@ -96,6 +98,7 @@ result = await client.traverse_paths(
96
98
kind_filter=["DcimCable", "InterfacePhysical"], # only traverse through these kinds
print("Result may be truncated — increase max_results to see more.")
230
234
```
231
235
236
+
For `traverse_paths`, the `PathTraversalResult` reports truncation directly via `result.truncated_at_depth`. It is `None` when the search completed within budget; otherwise it is the depth at which the server ran out of budget. In that case the returned paths are complete only for depths *less than* that value, and deeper paths may exist.
237
+
238
+
```python
239
+
result =await client.traverse_paths(source=src, destination=dst)
240
+
if result.truncated_at_depth isnotNone:
241
+
print(f"Search ran out of budget at depth {result.truncated_at_depth}; deeper paths may exist.")
242
+
```
243
+
232
244
## Common check patterns
233
245
234
246
These are the recurring questions graph traversal answers in an Infrahub check. The examples are async; the sync client mirrors them without `await`.
0 commit comments