pub struct ForwardGraph { /* private fields */ }
Expand description

Forward-time representation of a demes::Graph.

Implementations§

source§

impl ForwardGraph

source

pub fn new_discrete_time<F: Into<ForwardTime> + Debug + Copy>( graph: Graph, burnin_time: F ) -> Result<Self, DemesForwardError>

Constructor

Parameters
  • graph: a demes::Graph.
  • burnin_time: Burn-in time for the model.
  • rounding: Optional [demes::RoundTimeToInteger]
source

pub fn update_state<F: Into<ForwardTime> + Debug + Copy>( &mut self, parental_generation_time: F ) -> Result<(), DemesForwardError>

Update the internal state of the graph to the parental generation time parental_generation_time.

source

pub fn num_demes_in_model(&self) -> usize

The total number of demes in the graph.

source

pub fn ancestry_proportions(&self, offspring_deme: usize) -> Option<&[f64]>

The ancestry proporitions for a given offspring deme at the current time.

Parameters
  • offspring_deme: the index of an offspring deme.
Returns
  • Some(&[f64]) if offspring_deme is a valid index and extant offspring demes exist.
  • None otherwise.
source

pub fn cloning_rates(&self) -> Option<&[CloningRate]>

Get cloning rates of all offspring demes.

Returns None if there are no extant offspring demes.

source

pub fn selfing_rates(&self) -> Option<&[SelfingRate]>

Get selfing rates of all offspring demes.

Returns None if there are no extant offspring demes.

source

pub fn last_time_updated(&self) -> Option<ForwardTime>

Obtain the time corresponding to the last call of ForwardGraph::update_state.

source

pub fn end_time(&self) -> ForwardTime

Obtain the end time of the model.

source

pub fn time_iterator(&self) -> impl Iterator<Item = ForwardTime>

Return an iterator over time values.

The iterator starts at the last updated time and continues until the end time.

source

pub fn parental_deme_sizes(&self) -> Option<&[DemeSize]>

Obtain the sizes of each parental deme.

The length of the slice is equal to the number of demes in the graph (see ForwardGraph::num_demes_in_model).

Returns None if there are no parental demes at the current time.

source

pub fn offspring_deme_sizes(&self) -> Option<&[DemeSize]>

Obtain the sizes of each offspring deme.

The length of the slice is equal to the number of demes in the graph (see ForwardGraph::num_demes_in_model).

Returns None if there are no offspring demes at the current time.

source

pub fn any_extant_parental_demes(&self) -> bool

Return true if there are any extant parental demes at the current time.

source

pub fn any_extant_offspring_demes(&self) -> bool

Return true if there are any extant offspring demes at the current time.

source

pub fn num_extant_parental_demes(&self) -> usize

Return the number of extant parental demes at the current time.

source

pub fn num_extant_offspring_demes(&self) -> usize

Return the number of extant offspring demes at the current time.

Trait Implementations§

source§

impl Debug for ForwardGraph

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.