Struct demes_forward::ForwardGraph
source · pub struct ForwardGraph { /* private fields */ }Expand description
Forward-time representation of a demes::Graph.
Implementations§
source§impl ForwardGraph
impl ForwardGraph
sourcepub fn new<F: Into<ForwardTime> + Debug + Copy>(
graph: Graph,
burnin_time: F,
rounding: Option<RoundTimeToInteger>
) -> Result<Self, DemesForwardError>
pub fn new<F: Into<ForwardTime> + Debug + Copy>(
graph: Graph,
burnin_time: F,
rounding: Option<RoundTimeToInteger>
) -> Result<Self, DemesForwardError>
Constructor
Parameters
- graph: a
demes::Graph. - burnin_time: Burn-in time for the model.
- rounding: Optional
demes::RoundTimeToInteger
sourcepub fn update_state<F: Into<ForwardTime> + Debug + Copy>(
&mut self,
parental_generation_time: F
) -> Result<(), DemesForwardError>
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.
sourcepub fn num_demes_in_model(&self) -> usize
pub fn num_demes_in_model(&self) -> usize
The total number of demes in the graph.
sourcepub fn ancestry_proportions(&self, offspring_deme: usize) -> Option<&[f64]>
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])ifoffspring_demeis a valid index and extant offspring demes exist.Noneotherwise.
sourcepub fn cloning_rates(&self) -> Option<&[CloningRate]>
pub fn cloning_rates(&self) -> Option<&[CloningRate]>
Get cloning rates of all offspring demes.
Returns None if there are no extant offspring
demes.
sourcepub fn selfing_rates(&self) -> Option<&[SelfingRate]>
pub fn selfing_rates(&self) -> Option<&[SelfingRate]>
Get selfing rates of all offspring demes.
Returns None if there are no extant offspring
demes.
sourcepub fn last_time_updated(&self) -> Option<ForwardTime>
pub fn last_time_updated(&self) -> Option<ForwardTime>
Obtain the time corresponding to the last
call of ForwardGraph::update_state.
sourcepub fn end_time(&self) -> ForwardTime
pub fn end_time(&self) -> ForwardTime
Obtain the end time of the model.
sourcepub fn time_iterator(&self) -> impl Iterator<Item = ForwardTime>
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.
sourcepub fn parental_deme_sizes(&self) -> Option<&[DemeSize]>
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.
sourcepub fn offspring_deme_sizes(&self) -> Option<&[DemeSize]>
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.
sourcepub fn any_extant_parental_demes(&self) -> bool
pub fn any_extant_parental_demes(&self) -> bool
Return true if there are any extant parental
demes at the current time.
sourcepub fn any_extant_offspring_demes(&self) -> bool
pub fn any_extant_offspring_demes(&self) -> bool
Return true if there are any extant offspring
demes at the current time.
sourcepub fn num_extant_parental_demes(&self) -> usize
pub fn num_extant_parental_demes(&self) -> usize
Return the number of extant parental demes at the current time.
sourcepub fn num_extant_offspring_demes(&self) -> usize
pub fn num_extant_offspring_demes(&self) -> usize
Return the number of extant offspring demes at the current time.