pub struct AdjacencyMatrix<N = String, V = i64>{ /* private fields */ }Implementations§
Source§impl<N: Node, V: Clone + PartialEq> AdjacencyMatrix<N, V>
impl<N: Node, V: Clone + PartialEq> AdjacencyMatrix<N, V>
pub fn new() -> Self
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the matrix can hold without reallocating.
Sourcepub fn get(&self, key: &N) -> Option<&Vec<(N, V)>>
pub fn get(&self, key: &N) -> Option<&Vec<(N, V)>>
Returns a reference to the value corresponding to the key.
Sourcepub fn get_key_value(&self, key: &N) -> Option<(&N, &Vec<(N, V)>)>
pub fn get_key_value(&self, key: &N) -> Option<(&N, &Vec<(N, V)>)>
Returns a reference to the key and its value(s).
Sourcepub fn get_mut(&mut self, key: &N) -> Option<&mut Vec<(N, V)>>
pub fn get_mut(&mut self, key: &N) -> Option<&mut Vec<(N, V)>>
Returns a mutable reference to the value corresponding to the key.
Sourcepub fn keys(&self) -> impl Iterator<Item = &N>
pub fn keys(&self) -> impl Iterator<Item = &N>
Returns an iterator over the elements of the matrix.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the matrix as much as possible.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Reserves capacity for at least additional more elements to be inserted in the matrix.
Trait Implementations§
Source§impl<N, V> Clone for AdjacencyMatrix<N, V>
impl<N, V> Clone for AdjacencyMatrix<N, V>
Source§fn clone(&self) -> AdjacencyMatrix<N, V>
fn clone(&self) -> AdjacencyMatrix<N, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<N, V> Debug for AdjacencyMatrix<N, V>
impl<N, V> Debug for AdjacencyMatrix<N, V>
Source§impl<N, V> Default for AdjacencyMatrix<N, V>
impl<N, V> Default for AdjacencyMatrix<N, V>
Source§fn default() -> AdjacencyMatrix<N, V>
fn default() -> AdjacencyMatrix<N, V>
Returns the “default value” for a type. Read more
Source§impl<'de, N, V> Deserialize<'de> for AdjacencyMatrix<N, V>
impl<'de, N, V> Deserialize<'de> for AdjacencyMatrix<N, V>
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
Source§impl<N: Node, V: Clone + PartialEq> Extend<(N, Vec<(N, V)>)> for AdjacencyMatrix<N, V>
impl<N: Node, V: Clone + PartialEq> Extend<(N, Vec<(N, V)>)> for AdjacencyMatrix<N, V>
Source§fn extend<T: IntoIterator<Item = (N, Vec<(N, V)>)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (N, Vec<(N, V)>)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<N, V> Hash for AdjacencyMatrix<N, V>
impl<N, V> Hash for AdjacencyMatrix<N, V>
Source§impl<N, V> Index<N> for AdjacencyMatrix<N, V>
impl<N, V> Index<N> for AdjacencyMatrix<N, V>
Source§impl<N, V> IndexMut<N> for AdjacencyMatrix<N, V>
impl<N, V> IndexMut<N> for AdjacencyMatrix<N, V>
Source§impl<N, V> Ord for AdjacencyMatrix<N, V>
impl<N, V> Ord for AdjacencyMatrix<N, V>
Source§fn cmp(&self, other: &AdjacencyMatrix<N, V>) -> Ordering
fn cmp(&self, other: &AdjacencyMatrix<N, V>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<N, V> PartialEq for AdjacencyMatrix<N, V>
impl<N, V> PartialEq for AdjacencyMatrix<N, V>
Source§impl<N, V> PartialOrd for AdjacencyMatrix<N, V>
impl<N, V> PartialOrd for AdjacencyMatrix<N, V>
Source§impl<N, V> Serialize for AdjacencyMatrix<N, V>
impl<N, V> Serialize for AdjacencyMatrix<N, V>
impl<N, V> Eq for AdjacencyMatrix<N, V>
impl<N, V> StructuralPartialEq for AdjacencyMatrix<N, V>
Auto Trait Implementations§
impl<N, V> Freeze for AdjacencyMatrix<N, V>
impl<N, V> RefUnwindSafe for AdjacencyMatrix<N, V>where
N: RefUnwindSafe,
V: RefUnwindSafe,
impl<N, V> Send for AdjacencyMatrix<N, V>
impl<N, V> Sync for AdjacencyMatrix<N, V>
impl<N, V> Unpin for AdjacencyMatrix<N, V>
impl<N, V> UnwindSafe for AdjacencyMatrix<N, V>where
N: UnwindSafe,
V: UnwindSafe,
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