pub struct CouplingMap { /* private fields */ }Expand description
Coupling map representing the connectivity graph of a quantum device
Implementations§
Source§impl CouplingMap
impl CouplingMap
Sourcepub fn new(num_qubits: usize) -> Self
pub fn new(num_qubits: usize) -> Self
Create a new coupling map with the specified number of qubits
Sourcepub fn add_edge(&mut self, qubit1: usize, qubit2: usize)
pub fn add_edge(&mut self, qubit1: usize, qubit2: usize)
Add a bidirectional edge between two qubits
Sourcepub fn are_connected(&self, qubit1: usize, qubit2: usize) -> bool
pub fn are_connected(&self, qubit1: usize, qubit2: usize) -> bool
Check if two qubits are directly connected
Sourcepub const fn num_qubits(&self) -> usize
pub const fn num_qubits(&self) -> usize
Get the number of qubits
Sourcepub fn distance(&self, qubit1: usize, qubit2: usize) -> Distance
pub fn distance(&self, qubit1: usize, qubit2: usize) -> Distance
Compute the distance between two qubits using BFS
Sourcepub fn compute_distances(&mut self)
pub fn compute_distances(&mut self)
Pre-compute all-pairs shortest distances
Sourcepub fn shortest_path(&self, start: usize, end: usize) -> Option<Vec<usize>>
pub fn shortest_path(&self, start: usize, end: usize) -> Option<Vec<usize>>
Get the shortest path between two qubits
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the graph is connected
Sourcepub fn diameter(&self) -> Distance
pub fn diameter(&self) -> Distance
Get the diameter of the graph (maximum distance between any two nodes)
Sourcepub fn linear(num_qubits: usize) -> Self
pub fn linear(num_qubits: usize) -> Self
Create common device topologies Linear topology (1D chain)
Sourcepub fn all_to_all(num_qubits: usize) -> Self
pub fn all_to_all(num_qubits: usize) -> Self
All-to-all topology (complete graph)
Sourcepub fn ibm_nairobi() -> Self
pub fn ibm_nairobi() -> Self
IBM Nairobi device topology
Sourcepub fn google_sycamore() -> Self
pub fn google_sycamore() -> Self
Google Sycamore-like device topology
Sourcepub fn from_edges(num_qubits: usize, edges: &[(usize, usize)]) -> Self
pub fn from_edges(num_qubits: usize, edges: &[(usize, usize)]) -> Self
Load coupling map from adjacency list
Trait Implementations§
Source§impl Clone for CouplingMap
impl Clone for CouplingMap
Source§fn clone(&self) -> CouplingMap
fn clone(&self) -> CouplingMap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CouplingMap
impl Debug for CouplingMap
Source§impl Default for CouplingMap
impl Default for CouplingMap
Source§impl<'de> Deserialize<'de> for CouplingMap
impl<'de> Deserialize<'de> for CouplingMap
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CouplingMap
impl RefUnwindSafe for CouplingMap
impl Send for CouplingMap
impl Sync for CouplingMap
impl Unpin for CouplingMap
impl UnwindSafe for CouplingMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.