holoscan.graphs

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

holoscan.graphs.FlowGraph

Directed acyclic graph (DAG) class.

class holoscan.graphs.FlowGraph

Bases: holoscan.graphs._graphs.Graph

Directed acyclic graph (DAG) class.

Attributes

context

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

get_next_operators

Get the operators immediately downstream of a given operator.

get_operators

Get all operators.

get_root_operators

Get all root operators.

Methods

add_flow(self, op_u, op_v, port_map)

Add an edge to the graph.

add_operator(self, op)

Add a node to the graph.

get_port_map(self, op_u, op_v)

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

is_leaf(self, op)

Check if an operator is a leaf operator.

is_root(self, op)

Check if an operator is a root operator.

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

Directed acyclic graph (DAG) class.

add_flow(self: holoscan.graphs._graphs.FlowGraph, op_u: holoscan::Operator, op_v: holoscan::Operator, port_map: holoscan.graphs._graphs.EdgeDataElementType) → None

Add an edge to the graph.

Parameters
op_uOperator

The source operator.

op_vOperator

The destination operator.

port_mapdict

A map from the source operator’s port name to the destination operator’s port name(s).

add_operator(self: holoscan.graphs._graphs.FlowGraph, op: holoscan::Operator) → None

Add a node to the graph.

Parameters
opOperator

The node to add.

property context

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

property get_next_operators

Get the operators immediately downstream of a given operator.

Parameters
opOperator

A node in the graph.

Returns
list of Operator

A list containing the downstream operators.

property get_operators

Get all operators.

Returns
list of Operator

A list containing all operators.

get_port_map(self: holoscan.graphs._graphs.FlowGraph, op_u: holoscan::Operator, op_v: holoscan::Operator) → std::optional<std::shared_ptr<std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<void>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<void>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > > >

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

Parameters
op_uOperator

The source operator.

op_vOperator

The destination operator.

Returns
port_mapdict

A map from the source operator’s port name to the destination operator’s port name(s).

property get_root_operators

Get all root operators.

Returns
list of Operator

A list containing all root operators.

is_leaf(self: holoscan.graphs._graphs.FlowGraph, op: holoscan::Operator) → bool

Check if an operator is a leaf operator.

Parameters
opOperator

A node in the graph.

Returns
bool

Whether the operator is a leaf operator

is_root(self: holoscan.graphs._graphs.FlowGraph, op: holoscan::Operator) → bool

Check if an operator is a root operator.

Parameters
opOperator

A node in the graph.

Returns
bool

Whether the operator is a root operator

© Copyright 2022, NVIDIA. Last updated on Jun 28, 2023.