NVIDIA Holoscan SDK v3.1.0

holoscan.graphs

This module provides a Python API for the C++ API Graph classes.

holoscan.graphs.FlowGraph alias of holoscan.graphs._graphs.OperatorFlowGraph
holoscan.graphs.FragmentFlowGraph Directed graph class.
holoscan.graphs.OperatorFlowGraph Directed graph class.

holoscan.graphs.FlowGraph

alias of holoscan.graphs._graphs.OperatorFlowGraph

class holoscan.graphs.FragmentFlowGraph

Bases: holoscan.graphs._graphs.FragmentGraph

Directed graph class.

Attributes

context The graph's context (as an opaque PyCapsule object)

Methods

add_node(self, node) Add the node to the graph.
get_next_nodes(self, node) Get the nodes immediately downstream of a given node.
get_nodes(self) Get all nodes.
get_port_map(self, node_u, node_v) Get a port mapping dictionary between two nodes in the graph.
get_previous_nodes(self, node) Get the nodes immediately upstream of a given node.
get_root_nodes(self) Get all root nodes.
is_leaf(self, node) Check if the node is a leaf node.
is_root(self, node) Check if the node is a root node.
remove_node(self, node) Remove the node to the graph.

__init__(self: holoscan.graphs._graphs.FragmentFlowGraph) → None

Directed graph class.

add_node(self: holoscan.graphs._graphs.FragmentFlowGraph, node: holoscan::Fragment) → None

Add the node to the graph.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

The node to add.

property context

The graph’s context (as an opaque PyCapsule object)

get_next_nodes(self: holoscan.graphs._graphs.FragmentFlowGraph, node: holoscan::Fragment) → vector_of_node_type

Get the nodes immediately downstream of a given node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
list of Operator or Fragment

A list containing the downstream nodes.

get_nodes(self: holoscan.graphs._graphs.FragmentFlowGraph) → vector_of_node_type

Get all nodes.

The nodes are returned in the order they were added to the graph.

Returns
list of Operator or Fragment

A list containing all nodes.

get_port_map(self: holoscan.graphs._graphs.FragmentFlowGraph, node_u: holoscan::Fragment, node_v: holoscan::Fragment) → dict

Get a port mapping dictionary between two nodes in the graph.

Parameters
node_uholoscan.core.Operator | holoscan.core.Fragment

The source node.

node_vholoscan.core.Operator | holoscan.core.Fragment

The destination node.

Returns
port_mapdict

A map from the source node’s port name to the destination node’s port name(s). The keys of the dictionary are strings and the values are sets of strings.

get_previous_nodes(self: holoscan.graphs._graphs.FragmentFlowGraph, node: holoscan::Fragment) → vector_of_node_type

Get the nodes immediately upstream of a given node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
list of Operator or Fragment

A list containing the upstream nodes.

get_root_nodes(self: holoscan.graphs._graphs.FragmentFlowGraph) → vector_of_node_type

Get all root nodes.

Returns
list of Operator or Fragment

A list containing all root nodes.

is_leaf(self: holoscan.graphs._graphs.FragmentFlowGraph, node: holoscan::Fragment) → bool

Check if the node is a leaf node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
bool

Whether the node is a leaf node

is_root(self: holoscan.graphs._graphs.FragmentFlowGraph, node: holoscan::Fragment) → bool

Check if the node is a root node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
bool

Whether the node is a root node

remove_node(self: holoscan.graphs._graphs.FragmentFlowGraph, node: holoscan::Fragment) → None

Remove the node to the graph.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

The node to remove. This will also remove all edges connected to the node.

class holoscan.graphs.OperatorFlowGraph

Bases: holoscan.graphs._graphs.OperatorGraph

Directed graph class.

Attributes

context The graph's context (as an opaque PyCapsule object)

Methods

add_node(self, node) Add the node to the graph.
get_next_nodes(self, node) Get the nodes immediately downstream of a given node.
get_nodes(self) Get all nodes.
get_port_map(self, node_u, node_v) Get a port mapping dictionary between two nodes in the graph.
get_previous_nodes(self, node) Get the nodes immediately upstream of a given node.
get_root_nodes(self) Get all root nodes.
is_leaf(self, node) Check if the node is a leaf node.
is_root(self, node) Check if the node is a root node.
remove_node(self, node) Remove the node to the graph.

__init__(self: holoscan.graphs._graphs.OperatorFlowGraph) → None

Directed graph class.

add_node(self: holoscan.graphs._graphs.OperatorFlowGraph, node: holoscan::Operator) → None

Add the node to the graph.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

The node to add.

property context

The graph’s context (as an opaque PyCapsule object)

get_next_nodes(self: holoscan.graphs._graphs.OperatorFlowGraph, node: holoscan::Operator) → vector_of_node_type

Get the nodes immediately downstream of a given node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
list of Operator or Fragment

A list containing the downstream nodes.

get_nodes(self: holoscan.graphs._graphs.OperatorFlowGraph) → vector_of_node_type

Get all nodes.

The nodes are returned in the order they were added to the graph.

Returns
list of Operator or Fragment

A list containing all nodes.

get_port_map(self: holoscan.graphs._graphs.OperatorFlowGraph, node_u: holoscan::Operator, node_v: holoscan::Operator) → dict

Get a port mapping dictionary between two nodes in the graph.

Parameters
node_uholoscan.core.Operator | holoscan.core.Fragment

The source node.

node_vholoscan.core.Operator | holoscan.core.Fragment

The destination node.

Returns
port_mapdict

A map from the source node’s port name to the destination node’s port name(s). The keys of the dictionary are strings and the values are sets of strings.

get_previous_nodes(self: holoscan.graphs._graphs.OperatorFlowGraph, node: holoscan::Operator) → vector_of_node_type

Get the nodes immediately upstream of a given node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
list of Operator or Fragment

A list containing the upstream nodes.

get_root_nodes(self: holoscan.graphs._graphs.OperatorFlowGraph) → vector_of_node_type

Get all root nodes.

Returns
list of Operator or Fragment

A list containing all root nodes.

is_leaf(self: holoscan.graphs._graphs.OperatorFlowGraph, node: holoscan::Operator) → bool

Check if the node is a leaf node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
bool

Whether the node is a leaf node

is_root(self: holoscan.graphs._graphs.OperatorFlowGraph, node: holoscan::Operator) → bool

Check if the node is a root node.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

A node in the graph.

Returns
bool

Whether the node is a root node

remove_node(self: holoscan.graphs._graphs.OperatorFlowGraph, node: holoscan::Operator) → None

Remove the node to the graph.

Parameters
nodeholoscan.core.Operator | holoscan.core.Fragment

The node to remove. This will also remove all edges connected to the node.

Previous holoscan.executors
Next holoscan.gxf
© Copyright 2022-2025, NVIDIA. Last updated on Apr 7, 2025.