NVIDIA Holoscan SDK v0.5.1
Holoscan v0.5.1

Class Graph

class Graph

Abstract base class for all graphs.

Subclassed by holoscan::FlowGraph

Public Types

using NodeType = std::shared_ptr<Operator>

using EdgeDataElementType = std::unordered_map<std::string, std::set<std::string, std::less<>>>

using EdgeDataType = std::shared_ptr<EdgeDataElementType>

Public Functions

Graph() = default

virtual ~Graph() = default

virtual void add_operator(const NodeType &op) = 0

Add a node to the graph.

Parameters

op – The node to add.

virtual void add_flow(const NodeType &op_u, const NodeType &op_v, const EdgeDataType &port_map) = 0

Add an edge to the graph.

Parameters
  • op_u – A source operator.

  • op_v – A destination operator.

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

virtual std::optional<EdgeDataType> get_port_map(const NodeType &op_u, const NodeType &op_v) = 0

Get a mapping from the source operator’s port name to the destination operator’s port name(s).

Parameters
  • op_u – A source operator.

  • op_v – A destination operator.

Returns

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

virtual bool is_root(const NodeType &op) = 0

Check if the operator is a root operator.

Parameters

op – A node in the graph.

Returns

true if the operator is a root operator.

virtual bool is_leaf(const NodeType &op) = 0

Check if the operator is a leaf operator.

Parameters

op – A node in the graph.

Returns

true if the operator is a leaf operator.

virtual std::vector<NodeType> get_root_operators() = 0

Get all root operators.

Returns

A vector of root operators.

virtual std::vector<NodeType> get_operators() = 0

Get all operators.

Returns

A vector of all operators.

virtual std::vector<NodeType> get_next_operators(const NodeType &op) = 0

Get the next operators of the given operator.

Parameters

op – A node in the graph.

Returns

A vector of next operators.

inline virtual void context(void *context)

Set the context.

Parameters

context – The context.

inline virtual void *context()

Get the context.

Returns

The context.

Protected Attributes

void *context_ = nullptr

The context.

© Copyright 2022-2023, NVIDIA. Last updated on Jul 28, 2023.