sf.program_utils.grid_to_DAG¶

grid_to_DAG(grid)[source]

Transforms a grid of Commands to a DAG representation.

In the DAG (directed acyclic graph) each node is a Command instance, and edges point from Commands to their immediate dependents/followers.

Parameters

grid (dict[int, list[Command]]) – quantum circuit

Returns

same circuit in DAG form

Return type

networkx.DiGraph[Command]