pub struct Graph { /* private fields */ }
Expand description
A resolved demes Graph.
Instances of this type will be fully-resolved according to the machine data model described here.
A graph cannot be directly initialized. See:
Implementations
sourceimpl Graph
impl Graph
sourcepub fn get_deme_from_name<'name>(
&'name self,
name: &'name str
) -> Option<&'name Deme>
pub fn get_deme_from_name<'name>(
&'name self,
name: &'name str
) -> Option<&'name Deme>
sourcepub fn generation_time(&self) -> Option<GenerationTime>
pub fn generation_time(&self) -> Option<GenerationTime>
Get the GenerationTime
for the graph.
sourcepub fn time_units(&self) -> TimeUnits
pub fn time_units(&self) -> TimeUnits
Get the TimeUnits
for the graph.
sourcepub fn migrations(&self) -> &[AsymmetricMigration]
pub fn migrations(&self) -> &[AsymmetricMigration]
Get the migration events for the graph.
sourcepub fn to_generations(self) -> Result<Self, DemesError>
pub fn to_generations(self) -> Result<Self, DemesError>
Convert the time units to generations.
Errors
If the time unit of an event differs sufficiently in
magnitude from the generation_time
, it is possible
that conversion results in epochs (or migration
durations) of length zero, which will return an error.
If any field is unresolved, an error will be returned.
sourcepub fn to_integer_generations(
self,
round: RoundTimeToInteger
) -> Result<Graph, DemesError>
pub fn to_integer_generations(
self,
round: RoundTimeToInteger
) -> Result<Graph, DemesError>
Convert the time units to generations, rounding the output to an integer value.
sourcepub fn as_string(&self) -> Result<String, DemesError>
pub fn as_string(&self) -> Result<String, DemesError>
Return a representation of the graph as a string.
The format is in YAML and corresponds to the MDM representation of the data.
Error
Will return an error if serde_yaml::to_string
returns an error.
sourcepub fn most_recent_deme_end_time(&self) -> Time
pub fn most_recent_deme_end_time(&self) -> Time
Return the most recent end time of any deme in the Graph.
This function is useful to check if the most recent end time is greater than zero, meaning that the model ends at a time point ancestral to “now”.
Trait Implementations
impl Eq for Graph
Auto Trait Implementations
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.