Skip to main content

Graph Traversal reference

Reference for the InfrahubPathTraversal and InfrahubReachableNodes GraphQL queries.

InfrahubPathTraversal​

Input type: PathTraversalInput

ArgumentTypeRequiredDefaultMaxDescription
source_idStringYes——UUID of the start node
destination_idStringYes——UUID of the end node
max_depthIntNo530Maximum number of hops
max_pathsIntNo10100Maximum paths to return
kind_filter[String]No——Limit traversal to these kinds only
relationship_filter[String]No——Limit traversal to these relationship identifiers (schema identifier, e.g. device__interface)
excluded_namespaces[String]No——Additional namespaces to exclude; unioned with defaults
excluded_kinds[String]No——Additional kinds to exclude; unioned with defaults
included_kinds[String]No——Re-include kinds excluded by default. API only — not available in the UI.

Response type: PathTraversalResultType

FieldTypeDescription
countIntNumber of paths found
paths[PathResultType]Paths found, ordered shortest first
sourcePathNodeTypeThe start node
destinationPathNodeTypeThe end node
excluded_kinds[String]All kinds excluded in this traversal

Each PathResultType has depth (number of edges) and hops — an ordered list where each hop has a node and (except the first) a relationship. Each node (PathNodeType) exposes id, kind, label, display_label, and hfid. Each relationship (PathRelationshipType) exposes from_rel, from_label, to_rel, to_label, and kind.


InfrahubReachableNodes​

Input type: ReachableNodesInput

ArgumentTypeRequiredDefaultMaxDescription
source_idStringYes——UUID of the source node
target_kinds[String]Yes——Kinds to search for; at least one required
max_depthIntNo530Maximum hops to traverse
max_resultsIntNo50200Maximum distinct target nodes to find. Labeled Max Targets in the UI.
max_pathsIntNo5005000Maximum total paths across all targets
shortest_paths_onlyBooleanNotrue—When true, return only the shortest path to each target. When false, return every path within max_depth.

Response type: ReachableNodesResultType

FieldTypeDescription
countIntNumber of dependency entries returned
sourcePathNodeTypeThe source node
dependencies[ReachableNodeType]One entry per reachable node

Each ReachableNodeType has node, depth (hops from source), and path (full path from source to this node).


Default exclusions​

Excluded by defaultCan be re-included
Core, Internal, Builtin, Lineage, Profile, Template namespacesNo
BuiltinIPNamespace and all kinds that inherit itYes — via included_kinds in InfrahubPathTraversal (API only)

Use excluded_namespaces or excluded_kinds to add further exclusions.


Common errors​

ErrorCauseFix
Source and destination nodes must be differentsource_id equals destination_idUse two distinct UUIDs
At least one target kind is requiredtarget_kinds is emptyProvide at least one kind
Unknown target kind: <kind>Kind not found in schemaCheck the kind name against your schema
Source node not found: <id>UUID does not exist on this branchVerify the UUID and branch
Destination node not found: <id>Destination UUID does not exist on this branchVerify the UUID and branch
max_paths must be in [1, 100]Out of range for Path modeUse a value between 1 and 100
Query timed outSearch space too largeReduce max_depth, lower max_paths/max_results, or narrow with kind/namespace filters