Skip to main content

quantrs2_sim/automatic_parallelization/
autoparallelengine_gates_have_dependency_group.rs

1//! # AutoParallelEngine - gates_have_dependency_group Methods
2//!
3//! This module contains method implementations for `AutoParallelEngine`.
4//!
5//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
6
7use super::types::DependencyGraph;
8
9use super::autoparallelengine_type::AutoParallelEngine;
10
11impl AutoParallelEngine {
12    /// Check if two gates have a dependency
13    pub(super) fn gates_have_dependency(idx1: usize, idx2: usize, graph: &DependencyGraph) -> bool {
14        if let Some(deps) = graph.reverse_edges.get(&idx2) {
15            if deps.contains(&idx1) {
16                return true;
17            }
18        }
19        if let Some(deps) = graph.reverse_edges.get(&idx1) {
20            if deps.contains(&idx2) {
21                return true;
22            }
23        }
24        false
25    }
26}