Graphs#
Please see Holoscan SDK Python API for classes that are in this module.
- monai.deploy.graphs.FlowGraph
alias of
OperatorFlowGraphImpl
- monai.deploy.graphs.FlowGraphImpl
alias of
OperatorFlowGraphImpl
- class monai.deploy.graphs.FragmentFlowGraph
Bases:
pybind11_objectAbstract base class for all flow graphs
- class monai.deploy.graphs.FragmentFlowGraphImpl(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl)
Bases:
FragmentFlowGraphDirected flow graph implementation.
Directed flow graph implementation.
- add_node(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl, 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.flow_graphs._flow_graphs.FragmentFlowGraphImpl, 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.flow_graphs._flow_graphs.FragmentFlowGraphImpl) 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_connectivity_maps(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl) tuple
Get port connectivity maps for the graph.
Returns a tuple of two dictionaries: 1. Input ports to connected output ports mapping 2. Output ports to connected input ports mapping
Each port is identified by a unique string in the format “fragment.operator.port” (or “fragment.port” for FragmentFlowGraphImpl).
Returns#
- tuple[dict[str, list[str]], dict[str, list[str]]]
A tuple containing (input_to_output_map, output_to_input_map) where: - input_to_output_map: Maps input port IDs to lists of connected output port IDs - output_to_input_map: Maps output port IDs to lists of connected input port IDs
- get_port_map(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl, 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.flow_graphs._flow_graphs.FragmentFlowGraphImpl, 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.flow_graphs._flow_graphs.FragmentFlowGraphImpl) vector_of_node_type
Get all root nodes.
Returns#
- list of Operator or Fragment
A list containing all root nodes.
- is_leaf(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl, 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.flow_graphs._flow_graphs.FragmentFlowGraphImpl, 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
- port_map_description(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl) str
Get a YAML-formatted description of the port connectivity maps.
Returns a human-readable YAML string that describes the port connectivity of the graph.
Returns#
- str
A YAML-formatted string describing the port connectivity maps
- remove_node(self: holoscan.flow_graphs._flow_graphs.FragmentFlowGraphImpl, node: holoscan::Fragment) None
Remove the node from the graph.
Parameters#
- nodeholoscan.core.Operator | holoscan.core.Fragment
The node to remove. This will also remove all edges connected to the node.
- class monai.deploy.graphs.OperatorFlowGraph
Bases:
pybind11_objectAbstract base class for all flow graphs
- class monai.deploy.graphs.OperatorFlowGraphImpl(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl)
Bases:
OperatorFlowGraphDirected flow graph implementation.
Directed flow graph implementation.
- add_node(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl, 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.flow_graphs._flow_graphs.OperatorFlowGraphImpl, 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.flow_graphs._flow_graphs.OperatorFlowGraphImpl) 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_connectivity_maps(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl) tuple
Get port connectivity maps for the graph.
Returns a tuple of two dictionaries: 1. Input ports to connected output ports mapping 2. Output ports to connected input ports mapping
Each port is identified by a unique string in the format “fragment.operator.port” (or “fragment.port” for FragmentFlowGraphImpl).
Returns#
- tuple[dict[str, list[str]], dict[str, list[str]]]
A tuple containing (input_to_output_map, output_to_input_map) where: - input_to_output_map: Maps input port IDs to lists of connected output port IDs - output_to_input_map: Maps output port IDs to lists of connected input port IDs
- get_port_map(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl, 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.flow_graphs._flow_graphs.OperatorFlowGraphImpl, 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.flow_graphs._flow_graphs.OperatorFlowGraphImpl) vector_of_node_type
Get all root nodes.
Returns#
- list of Operator or Fragment
A list containing all root nodes.
- is_leaf(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl, 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.flow_graphs._flow_graphs.OperatorFlowGraphImpl, 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
- port_map_description(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl) str
Get a YAML-formatted description of the port connectivity maps.
Returns a human-readable YAML string that describes the port connectivity of the graph.
Returns#
- str
A YAML-formatted string describing the port connectivity maps
- remove_node(self: holoscan.flow_graphs._flow_graphs.OperatorFlowGraphImpl, node: holoscan::Operator) None
Remove the node from the graph.
Parameters#
- nodeholoscan.core.Operator | holoscan.core.Fragment
The node to remove. This will also remove all edges connected to the node.