Skip to main content

TriadCensus

Struct TriadCensus 

Source
pub struct TriadCensus {
    pub counts: [f64; 16],
}
Expand description

The triad census of a graph, see Graph::triad_census.

Holds the number of vertex triples of each of the 16 types described by Davis and Leinhardt’s MAN labels (TriadCensus::NAMES): the digits count Mutual, Asymmetric and Null dyads of the triple, and the letter distinguishes Down, Up, Cyclic and Transitive variants. Index it by position (census[3]) or by label (census["021D"]).

Fields§

§counts: [f64; 16]

The 16 counts, in the order of TriadCensus::NAMES.

Implementations§

Source§

impl TriadCensus

Source

pub const NAMES: [&'static str; 16]

The MAN labels of the 16 triad types, in igraph’s order:

idxlabelshape
0003empty
1012A→B, C
2102A↔B, C
3021DA←B→C (out-star)
4021UA→B←C (in-star)
5021CA→B→C (directed line)
6111DA↔B←C
7111UA↔B→C
8030TA→B←C, A→C
9030CA←B←C, A→C (cycle)
10201A↔B↔C
11120DA←B→C, A↔C
12120UA→B←C, A↔C
13120CA→B→C, A↔C
14210A→B↔C, A↔C
15300complete
Source

pub fn get(&self, label: &str) -> Option<f64>

The count of the triad type with the given MAN label, if valid.

Source

pub fn iter(&self) -> impl Iterator<Item = (&'static str, f64)> + '_

Iterates over (label, count) pairs.

Source

pub fn total(&self) -> f64

Total number of triples, n (n-1) (n-2) / 6.

Trait Implementations§

Source§

impl Clone for TriadCensus

Source§

fn clone(&self) -> TriadCensus

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 Copy for TriadCensus

Source§

impl Debug for TriadCensus

Source§

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

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

impl Index<&str> for TriadCensus

Source§

fn index(&self, label: &str) -> &f64

§Panics

If label is not one of TriadCensus::NAMES.

Source§

type Output = f64

The returned type after indexing.
Source§

impl Index<usize> for TriadCensus

Source§

type Output = f64

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &f64

Performs the indexing (container[index]) operation. Read more
Source§

impl PartialEq for TriadCensus

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TriadCensus

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> 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> 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.