pub struct SISModel {
pub adjacency: AdjList,
pub beta: f64,
pub gamma: f64,
pub num_nodes: usize,
pub max_steps: usize,
}Expand description
SIS epidemic model (Susceptible–Infected–Susceptible).
Like SIR except Recovered nodes return to Susceptible rather than
gaining immunity. The simulation terminates when no infected nodes remain
or after max_steps steps.
Fields§
§adjacency: AdjListAdjacency list.
beta: f64Infection probability per edge per step.
gamma: f64Recovery probability per step (returns to Susceptible).
num_nodes: usizeTotal number of nodes.
max_steps: usizeMaximum simulation steps before forced termination.
Implementations§
Source§impl SISModel
impl SISModel
Sourcepub fn new(
adjacency: AdjList,
num_nodes: usize,
beta: f64,
gamma: f64,
max_steps: usize,
) -> Result<Self>
pub fn new( adjacency: AdjList, num_nodes: usize, beta: f64, gamma: f64, max_steps: usize, ) -> Result<Self>
Sourcepub fn from_edges(
edges: &[(usize, usize)],
num_nodes: usize,
beta: f64,
gamma: f64,
max_steps: usize,
) -> Result<Self>
pub fn from_edges( edges: &[(usize, usize)], num_nodes: usize, beta: f64, gamma: f64, max_steps: usize, ) -> Result<Self>
Build from unweighted edge list.
Sourcepub fn simulate(&self, initial_infected: &[usize]) -> Result<SimulationResult>
pub fn simulate(&self, initial_infected: &[usize]) -> Result<SimulationResult>
Run a single SIS simulation from initial infected set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SISModel
impl RefUnwindSafe for SISModel
impl Send for SISModel
impl Sync for SISModel
impl Unpin for SISModel
impl UnsafeUnpin for SISModel
impl UnwindSafe for SISModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more