These commits bring the layers function down to rustworkx-core so that it can be used within the rust interface. This function was only available through a python interface previously.
Changes
rustworkx.rustworkx-core.layerslayers(): This function returns a list of subgraphs whose nodes are disjointed.
The main difference between this and its python counterpart is that this function only returns a list of NodeId instances. To get the weights/data stored in these nodes, the user can iterate through the graph accessing the weights based on the instance of NodeId.
rustworkx.dag_algolayers(): This function is similar to the one in rustworkx-core, but allows the user to choose between getting node indices and node weights/data.
The logic has been updated to use the rustworkx-core version, but its behavior is identical to what it was previously.
Future directions:
To return an Iterator instance from rustworkx-core, instead of a Vec<Vec<G::NodeId>> to prevent from unnecessary allocations.Added!
Attempts to resolve #1167
Summary
These commits bring the
layers
function down torustworkx-core
so that it can be used within the rust interface. This function was only available through a python interface previously.Changes
rustworkx.rustworkx-core.layers
layers()
: This function returns a list of subgraphs whose nodes are disjointed.NodeId
instances. To get the weights/data stored in these nodes, the user can iterate through the graph accessing the weights based on the instance ofNodeId
.rustworkx.dag_algo
layers()
: This function is similar to the one inrustworkx-core
, but allows the user to choose between getting node indices and node weights/data.rustworkx-core
version, but its behavior is identical to what it was previously.Future directions:
To return anAdded!Iterator
instance fromrustworkx-core
, instead of aVec<Vec<G::NodeId>>
to prevent from unnecessary allocations.Open to suggestions.