Skip to main content

AdjacencyReport

Struct AdjacencyReport 

Source
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

Source

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);
Source

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);
Source

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());
Source

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());
Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdjacencyReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AdjacencyReport

Source§

impl PartialEq for AdjacencyReport

Source§

fn eq(&self, other: &AdjacencyReport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AdjacencyReport

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.