Warning
The documentation for retworkx has migrated to:
https://qiskit.org/documentation/retworkx
These docs will no longer be updated.
retworkx.layers¶
- layers(dag, first_layer, /)¶
Return a list of layers
A layer is a subgraph whose nodes are disjoint, i.e., a layer has depth 1. The layers are constructed using a greedy algorithm.
- Parameters
graph (PyDiGraph) – The DAG to get the layers from
first_layer (list) – A list of node ids for the first layer. This will be the first layer in the output
- Returns
A list of layers, each layer is a list of node data
- Return type
list
- Raises
InvalidNode – If a node index in
first_layer
is not in the graph