This commit introduces a new heuristic, `CriticalHeuristic`, to the SABRE routing algorithm in Qiskit. The `CriticalHeuristic` prioritizes routing decisions based on the criticality of quantum operations, as determined by their descendant count in the circuit's Directed Acyclic Graph (DAG).
### Changes in heuristic.rs:
- **CriticalHeuristic Added**:
- Introduced a new `CriticalHeuristic` struct that ranks quantum gates by the number of descendants they have, assigning a higher priority to gates with more descendants.
- The `CriticalHeuristic` is implemented with `weight` and `scale` parameters, allowing users to control the heuristic's impact during the routing process.
### Changes in route.rs:
- **Descendant Ranking Map**:
- Added a new `descendants_rank` field in the `RoutingState` struct to store the ranking of nodes based on the number of descendants. This map is populated only when the `CriticalHeuristic` is enabled.
- Introduced a new method `populate_descendants_rank_map` that calculates and ranks nodes based on their number of descendants, storing the results in the `descendants_rank` map.
- **CriticalHeuristic Integration**:
- In the `choose_best_swap` method, the `CriticalHeuristic` now evaluates potential swaps by considering how they enable the routing of gates with high descendant rankings. Swaps that allow the routing of more critical operations are favored.
- The `update_route` method and the main routing loop in `swap_map_trial` have been updated to integrate the `CriticalHeuristic`, ensuring that routing decisions consider the criticality of operations when this heuristic is used.
### Notes:
- This enhancement gives users the ability to prioritize critical paths during the routing process, potentially leading to more optimized circuits by reducing the risk of bottlenecks and minimizing overall circuit depth.
- We may need to rethink the scoring strategy for the `CriticalHeuristic` based on benchmarking results to ensure it performs optimally across different circuit types and sizes.