monai.deploy.core.graphs.NetworkXGraph

class monai.deploy.core.graphs.NetworkXGraph(**kwargs)[source]

Bases: monai.deploy.core.graphs.graph.Graph

NetworkX graph implementation.

Methods

__init__(**kwargs)

add_flow(op_u, op_v, io_map)

Add an edge to the graph.

add_operator(op)

Add a node to the graph.

gen_next_operators(op)

Get next operators.

gen_worklist()

Get worklist.

get_io_map(op_u, op_v)

Get a mapping from the source operator’s output label to the destination operator’s input label.

get_operators()

Get all operators.

get_root_operators()

Get all root operators.

is_leaf(op)

Check if the operator is a leaf operator.

is_root(op)

Check if the operator is a root operator.

add_flow(op_u, op_v, io_map)[source]

Add an edge to the graph.

Parameters
  • op_u (Operator) – A source operator.

  • op_v (Operator) – A destination operator.

  • io_map (Dict[str, Set[str]]) – A dictionary of mapping from the source operator’s label to the destination operator’s label(s).

add_operator(op)[source]

Add a node to the graph.

gen_next_operators(op)[source]

Get next operators.

Return type

Generator[Optional[Operator], None, None]

gen_worklist()[source]

Get worklist.

Return type

Generator[Optional[Operator], None, None]

get_io_map(op_u, op_v)[source]

Get a mapping from the source operator’s output label to the destination operator’s input label. :type op_u: Operator :param op_u: A source operator. :type op_u: Operator :param op_v: A destination operator. :type op_v: Operator

Return type

Dict[str, Set[str]]

Returns

A dictionary of mapping from the source operator’s output label to the destination operator’s input label(s).

get_operators()[source]

Get all operators.

Return type

Generator[Operator, None, None]

Returns

A generator of operators.

get_root_operators()[source]

Get all root operators.

Return type

Generator[Operator, None, None]

Returns

A generator of root operators.

is_leaf(op)[source]

Check if the operator is a leaf operator.

Parameters

op (Operator) – A node in the graph.

Return type

bool

Returns

True if the operator is a leaf operator.

is_root(op)[source]

Check if the operator is a root operator.

Parameters

op (Operator) – A node in the graph.

Return type

bool

Returns

True if the operator is a root operator.