calculate_graph

static FunctionNamespace.calculate_graph(*, graph, output_node_names, **kwargs)

Evaluates a graph corresponding to a set of generic functions.

Use this function to carry out computations expressed as a graph representing a collection of arbitrary functions.

Parameters
  • graph (pythonflow.core.Graph) – The graph describing the outputs. It must contain nodes with names \(\{s_j\}\) (giving the output functions).

  • output_node_names (List[str]) – The names \(\{s_j\}\) of the graph nodes that define the output functions. The function evaluates these and returns them in the output.

Returns

The result of a graph evaluation. It includes the evaluated outputs.

Return type

qctrl.dynamic.types.graph.Result

Notes

This function computes arbitrary functions represented by a graph.

The graph is made up of primitive nodes defined in the operations namespace of the Q-CTRL Python package, where each node represents a function of previous nodes (or constant values). You can assign a name to any node and request a list of named nodes \(\{s_j\}\) as the outputs to be evaluated.