This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
- layers(dag, first_layer, /, index_output=False)#
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.
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
index_output (bool) – When set to to
Truethe output layers will be a list of integer node indices.
A list of layers, each layer is a list of node data, or if
Trueeach layer is a list of node indices.
- Return type:
InvalidNode – If a node index in
first_layeris not in the graph