Skip to content

Commit

Permalink
Rexport NodeIndex from qiskit_circuit::dag
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman committed Jan 22, 2025
1 parent b43327d commit 6a74e20
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 25 deletions.
3 changes: 1 addition & 2 deletions crates/accelerate/src/barrier_before_final_measurement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

use hashbrown::HashSet;
use pyo3::prelude::*;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::circuit_instruction::ExtraInstructionAttributes;
use qiskit_circuit::dag::{DAGCircuit, NodeType};
use qiskit_circuit::dag::{DAGCircuit, NodeIndex, NodeType};
use qiskit_circuit::imports::BARRIER;
use qiskit_circuit::operations::{Operation, PyInstruction};
use qiskit_circuit::packed_instruction::{PackedInstruction, PackedOperation};
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/commutation_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use hashbrown::HashMap;
use pyo3::prelude::*;

use pyo3::types::{PyDict, PyList};
use qiskit_circuit::dag::{DAGCircuit, NodeType, Wire};
use rustworkx_core::petgraph::stable_graph::NodeIndex;
use qiskit_circuit::dag::{DAGCircuit, NodeIndex, NodeType, Wire};

// Custom types to store the commutation sets and node indices,
// see the docstring below for more information.
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/commutation_cancellation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ use hashbrown::{HashMap, HashSet};
use pyo3::exceptions::PyRuntimeError;
use pyo3::prelude::*;
use pyo3::{pyfunction, wrap_pyfunction, Bound, PyResult, Python};
use rustworkx_core::petgraph::stable_graph::NodeIndex;
use smallvec::{smallvec, SmallVec};

use qiskit_circuit::dag::{DAGCircuit, NodeType, Wire};
use qiskit_circuit::dag::{DAGCircuit, NodeIndex, NodeType, Wire};
use qiskit_circuit::operations::StandardGate::{
CXGate, CYGate, CZGate, HGate, PhaseGate, RXGate, RZGate, SGate, TGate, U1Gate, XGate, YGate,
ZGate,
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/consolidate_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ use num_complex::Complex64;
use numpy::{IntoPyArray, PyReadonlyArray2};
use pyo3::intern;
use pyo3::prelude::*;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::circuit_data::CircuitData;
use qiskit_circuit::dag::DAGCircuit;
use qiskit_circuit::dag::{DAGCircuit, NodeIndex};
use qiskit_circuit::gate_matrix::{ONE_QUBIT_IDENTITY, TWO_QUBIT_IDENTITY};
use qiskit_circuit::imports::{QI_OPERATOR, QUANTUM_CIRCUIT, UNITARY_GATE};
use qiskit_circuit::operations::{Operation, Param};
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/convert_2q_block_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ use num_complex::Complex64;
use numpy::ndarray::linalg::kron;
use numpy::ndarray::{aview2, Array2, ArrayView2};
use numpy::PyReadonlyArray2;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::dag::DAGCircuit;
use qiskit_circuit::dag::{DAGCircuit, NodeIndex};
use qiskit_circuit::gate_matrix::ONE_QUBIT_IDENTITY;
use qiskit_circuit::imports::QI_OPERATOR;
use qiskit_circuit::operations::{Operation, OperationRef};
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/euler_one_qubit_decomposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ use pyo3::Python;
use ndarray::prelude::*;
use numpy::PyReadonlyArray2;
use pyo3::pybacked::PyBackedStr;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::circuit_data::CircuitData;
use qiskit_circuit::dag::{DAGCircuit, DAGOpNode, NodeType};
use qiskit_circuit::dag::{DAGCircuit, DAGOpNode, NodeIndex, NodeType};
use qiskit_circuit::operations::{Operation, Param, StandardGate};
use qiskit_circuit::slice::{PySequenceIndex, SequenceIndex};
use qiskit_circuit::util::c64;
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/filter_op_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
use pyo3::prelude::*;
use pyo3::wrap_pyfunction;

use qiskit_circuit::dag::DAGCircuit;
use qiskit_circuit::dag::{DAGCircuit, NodeIndex};
use qiskit_circuit::packed_instruction::PackedInstruction;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

#[pyfunction]
#[pyo3(name = "filter_op_nodes")]
Expand Down
4 changes: 1 addition & 3 deletions crates/accelerate/src/gate_direction.rs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ use qiskit_circuit::{
circuit_instruction::CircuitInstruction,
circuit_instruction::ExtraInstructionAttributes,
converters::{circuit_to_dag, QuantumCircuitData},
dag::DAGCircuit,
dag::{DAGNode, DAGOpNode},
dag::{DAGCircuit, DAGNode, DAGOpNode, NodeIndex},
imports,
imports::get_std_gate_class,
operations::Operation,
Expand All @@ -34,7 +33,6 @@ use qiskit_circuit::{
packed_instruction::PackedInstruction,
Qubit,
};
use rustworkx_core::petgraph::stable_graph::NodeIndex;
use smallvec::{smallvec, SmallVec};
use std::f64::consts::PI;

Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/inverse_cancellation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ use ahash::RandomState;
use hashbrown::HashSet;
use indexmap::IndexMap;
use pyo3::prelude::*;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::circuit_instruction::OperationFromPython;
use qiskit_circuit::dag::{DAGCircuit, NodeType};
use qiskit_circuit::dag::{DAGCircuit, NodeIndex, NodeType};
use qiskit_circuit::operations::Operation;
use qiskit_circuit::packed_instruction::PackedInstruction;

Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/remove_identity_equiv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
use num_complex::Complex64;
use num_complex::ComplexFloat;
use pyo3::prelude::*;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use crate::nlayout::PhysicalQubit;
use crate::target_transpiler::Target;
use qiskit_circuit::dag::DAGCircuit;
use qiskit_circuit::dag::{DAGCircuit, NodeIndex};
use qiskit_circuit::operations::Operation;
use qiskit_circuit::operations::OperationRef;
use qiskit_circuit::operations::Param;
Expand Down
3 changes: 1 addition & 2 deletions crates/accelerate/src/split_2q_unitaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
use pyo3::intern;
use pyo3::prelude::*;
use pyo3::types::PyDict;
use rustworkx_core::petgraph::stable_graph::NodeIndex;

use qiskit_circuit::circuit_instruction::OperationFromPython;
use qiskit_circuit::dag::{DAGCircuit, NodeType, Wire};
use qiskit_circuit::dag::{DAGCircuit, NodeIndex, NodeType, Wire};
use qiskit_circuit::imports::UNITARY_GATE;
use qiskit_circuit::operations::{Operation, Param};

Expand Down
3 changes: 2 additions & 1 deletion crates/circuit/src/dag/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ use rustworkx_core::graph_ext::ContractNodesDirected;
use rustworkx_core::petgraph;
use rustworkx_core::petgraph::prelude::StableDiGraph;
use rustworkx_core::petgraph::prelude::*;
use rustworkx_core::petgraph::stable_graph::{EdgeReference, NodeIndex};
use rustworkx_core::petgraph::stable_graph::EdgeReference;
pub use rustworkx_core::petgraph::stable_graph::NodeIndex;
use rustworkx_core::petgraph::unionfind::UnionFind;
use rustworkx_core::petgraph::visit::{
EdgeIndexable, IntoEdgeReferences, IntoNodeReferences, NodeFiltered, NodeIndexable,
Expand Down
2 changes: 1 addition & 1 deletion crates/circuit/src/dag/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ mod rustworkx_core_vnext;
::pyo3::import_exception!(qiskit.dagcircuit.exceptions, DAGCircuitError);

pub use self::{
circuit::{DAGCircuit, NodeType, Wire},
circuit::{DAGCircuit, NodeIndex, NodeType, Wire},
node::{DAGInNode, DAGNode, DAGOpNode, DAGOutNode},
};

0 comments on commit 6a74e20

Please sign in to comment.