pub struct AdjacencyReport { /* private fields */ }Expand description
Observable adjacency-construction results for a set of edges.
§Examples
ⓘ
use whitaker_common::test_support::decomposition::{EdgeInput, adjacency_report};
let report = adjacency_report(3, &[
EdgeInput { left: 0, right: 1, weight: 5 },
]);
assert!(report.is_ok());
let report = report.unwrap();
assert_eq!(report.node_count(), 3);
assert!(report.is_symmetric());Implementations§
Source§impl AdjacencyReport
impl AdjacencyReport
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the adjacency graph.
use whitaker_common::test_support::decomposition::{EdgeInput, adjacency_report};
let report = adjacency_report(4, &[]).expect("valid input");
assert_eq!(report.node_count(), 4);Sourcepub fn neighbours_of(&self, node: usize) -> Option<&[(usize, u64)]>
pub fn neighbours_of(&self, node: usize) -> Option<&[(usize, u64)]>
Returns the neighbour list for node, sorted by neighbour index.
Returns None if node is out of range.
use whitaker_common::test_support::decomposition::{EdgeInput, adjacency_report};
let report = adjacency_report(3, &[
EdgeInput { left: 0, right: 2, weight: 7 },
]).expect("valid input");
assert_eq!(report.neighbours_of(0), Some(&[(2, 7)][..]));
assert_eq!(report.neighbours_of(10), None);Sourcepub fn all_indices_in_bounds(&self) -> bool
pub fn all_indices_in_bounds(&self) -> bool
Returns true if all neighbour indices are within bounds.
use whitaker_common::test_support::decomposition::{EdgeInput, adjacency_report};
let report = adjacency_report(3, &[
EdgeInput { left: 0, right: 1, weight: 5 },
]).expect("valid input");
assert!(report.all_indices_in_bounds());Sourcepub fn is_symmetric(&self) -> bool
pub fn is_symmetric(&self) -> bool
Returns true if the adjacency lists are symmetric: for every entry
(node -> neighbour, weight), the mirrored entry exists.
use whitaker_common::test_support::decomposition::{EdgeInput, adjacency_report};
let report = adjacency_report(3, &[
EdgeInput { left: 0, right: 2, weight: 7 },
]).expect("valid input");
assert!(report.is_symmetric());Sourcepub fn is_sorted(&self) -> bool
pub fn is_sorted(&self) -> bool
Returns true if each per-node neighbour list is sorted by neighbour
index.
use whitaker_common::test_support::decomposition::{EdgeInput, adjacency_report};
let report = adjacency_report(4, &[
EdgeInput { left: 0, right: 1, weight: 5 },
EdgeInput { left: 0, right: 3, weight: 3 },
]).expect("valid input");
assert!(report.is_sorted());Trait Implementations§
Source§impl Clone for AdjacencyReport
impl Clone for AdjacencyReport
Source§fn clone(&self) -> AdjacencyReport
fn clone(&self) -> AdjacencyReport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 AdjacencyReport
impl Debug for AdjacencyReport
impl Eq for AdjacencyReport
Source§impl PartialEq for AdjacencyReport
impl PartialEq for AdjacencyReport
impl StructuralPartialEq for AdjacencyReport
Auto Trait Implementations§
impl Freeze for AdjacencyReport
impl RefUnwindSafe for AdjacencyReport
impl Send for AdjacencyReport
impl Sync for AdjacencyReport
impl Unpin for AdjacencyReport
impl UnsafeUnpin for AdjacencyReport
impl UnwindSafe for AdjacencyReport
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