MarkovFlow

Struct MarkovFlow 

Source
pub struct MarkovFlow {
    pub adjacency_matrix: DMatrix<f64>,
    pub dim: usize,
    pub sink_matrix: DMatrix<f64>,
    pub sensitivity_matrix: DMatrix<f64>,
    pub influence_matrix: DMatrix<f64>,
    pub origin_matrix: DMatrix<f64>,
    pub dependency_matrix: DMatrix<f64>,
    pub in_vector: DVector<f64>,
    pub flow_vector: DVector<f64>,
    pub flow_matrix: DMatrix<f64>,
}
Expand description

MarkovFlow struct contains all results of the Markov flow calculations based on an adjacency matrix, evaporation constant, and scaling toggle.

§Example

extern crate nalgebra as na;
use ratio_markov::{DMatrix, DVector, MarkovFlow};
let adj = DMatrix::from_row_slice(3, 3, &[2.0, 0.5, 0.7, 1.0, 2.0, 3.0, 1.0, 2.6, 0.1]);
let markov = MarkovFlow::new(&adj, 4.0, false);

Fields§

§adjacency_matrix: DMatrix<f64>

Adjacency matrix with only positive values. Negatives are set to 0.0.

§dim: usize

Dimension of this problem (size of adjacency matrix axes).

§sink_matrix: DMatrix<f64>

Sink matrix. A probability matrix that has been provided with a evaporation sink.

§sensitivity_matrix: DMatrix<f64>

Sensitivity matrix that shows how much flow from a source node ends up in another node if it were injected with 1.0.

§influence_matrix: DMatrix<f64>

Influence matrix, percentage of outflow through j ends up in i.

§origin_matrix: DMatrix<f64>

Origin matrix that shows how much flow originates from a source node in a target node if its flow is 1.0.

§dependency_matrix: DMatrix<f64>

Dependency matrix, percentage of inflow through j coming from i.

§in_vector: DVector<f64>

Input vector (ones or scaled).

§flow_vector: DVector<f64>

Flow vector through each node w.r.t. input vector.

§flow_matrix: DMatrix<f64>

Flow matrix denoting the resulting flow over every edge when the system is injected with in_vector.

Implementations§

Source§

impl MarkovFlow

Source

pub fn new(adj: &DMatrix<f64>, mu: f64, scale: bool) -> MarkovFlow

New MarkovFlow struct containing all Markov chain calculations.

§Arguments
  • adj - Square adjacency matrix with nodes in identical order on both axis. Only positive adjacency values are used in the calculations.
  • mu - Evaporation constant. Factor by which flow is reduced after passing through a node.
  • scale - Whether injected flow in each node should be scaled according to the output adjacency of a node.

Trait Implementations§

Source§

impl Debug for MarkovFlow

Source§

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

Formats the value using the given formatter. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.