holoscan.graphs
This module provides a Python API for the C++ API Graph classes.
|
Directed acyclic graph (DAG) class. |
- class holoscan.graphs.FlowGraph
Bases:
<a href="holoscan_python_api_core.html#holoscan.core.Graph">holoscan.graphs._graphs.Graph</a>
Directed acyclic graph (DAG) class.
Attributes
<a href="#holoscan.graphs.FlowGraph.context">context</a>
The graph's context (as an opaque PyCapsule object)
<a href="#holoscan.graphs.FlowGraph.get_next_operators">get_next_operators</a>
Get the operators immediately downstream of a given operator.
<a href="#holoscan.graphs.FlowGraph.get_operators">get_operators</a>
Get all operators.
<a href="#holoscan.graphs.FlowGraph.get_root_operators">get_root_operators</a>
Get all root operators.
Methods
<a href="#holoscan.graphs.FlowGraph.add_flow">add_flow</a>
(self, op_u, op_v, port_map)Add an edge to the graph.
<a href="#holoscan.graphs.FlowGraph.add_operator">add_operator</a>
(self, op)Add a node to the graph.
<a href="#holoscan.graphs.FlowGraph.get_port_map">get_port_map</a>
(self, op_u, op_v)Get a port mapping dictionary between two operators in the graph.
<a href="#holoscan.graphs.FlowGraph.is_leaf">is_leaf</a>
(self, op)Check if an operator is a leaf operator.
<a href="#holoscan.graphs.FlowGraph.is_root">is_root</a>
(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
- op_vOperator
- port_mapdict
The source operator.
The destination operator.
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
- opholoscan.core.Operator
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
- opholoscan.core.Operator
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_uholoscan.core.Operator
- op_vholoscan.core.Operator
The source operator.
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
- opholoscan.core.Operator
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
- opholoscan.core.Operator
A node in the graph.
- Returns
- bool
Whether the operator is a root operator