Qiskit / rustworkx

A high performance Python graph library implemented in Rust.
https://www.rustworkx.org
Apache License 2.0
967 stars 140 forks source link

Loosen trait constraints and simplify structure for longest_path #1195

Closed mtreinish closed 1 month ago

mtreinish commented 1 month ago

In the recently merged #1192 a new generic DAG longest_path function was added to rustworkx-core. However, the trait bounds on the function were a bit tighter than they needed to be. The traits were forcing NodeId to be of a NodeIndex type and this wasn't really required. The only requirement that the NodeId type can be put on a hashmap and do a partial compare (that implements Hash, Eq, and PartialOrd). Also the IntoNeighborsDirected wasn't required because it's methods weren't ever used. This commit loosens the traits bounds to facilitate this. At the same time this also simplifies the code structure a bit to reduce the separation of the rust code structure in the rustworkx crate using longest_path().

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 9133077909

Details


Files with Coverage Reduction New Missed Lines %
src/shortest_path/all_pairs_bellman_ford.rs 6 95.53%
<!-- Total: 6 -->
Totals Coverage Status
Change from base Build 9104623275: -0.04%
Covered Lines: 16744
Relevant Lines: 17356

💛 - Coveralls