pub struct ReliabilityPolynomial {
pub coeffs: Vec<u64>,
pub num_edges: usize,
pub num_nodes: usize,
}Expand description
Exact reliability polynomial for small networks (|E| ≤ 20).
For a network where all edges have the same survival probability p, the
all-terminal reliability is a polynomial in p:
R(p) = Σ_{k=0}^{m} c_k p^k (1−p)^{m−k}
where c_k is the number of edge subsets of size k that make the graph
connected. This struct computes the coefficient vector [c_0, c_1, …, c_m]
by exhaustive enumeration and stores it for fast evaluation at any p.
Fields§
§coeffs: Vec<u64>Coefficients: coeffs[k] = number of connected edge subsets of size k.
num_edges: usizeTotal number of edges.
num_nodes: usizeNumber of nodes.
Implementations§
Source§impl ReliabilityPolynomial
impl ReliabilityPolynomial
Sourcepub fn compute(adj: &Array2<f64>) -> Result<Self>
pub fn compute(adj: &Array2<f64>) -> Result<Self>
Compute the reliability polynomial for a graph where all edges have equal survival probability.
Only feasible for |E| ≤ 20.
Sourcepub fn evaluate(&self, p: f64) -> f64
pub fn evaluate(&self, p: f64) -> f64
Evaluate the reliability polynomial at survival probability p.
R(p) = Σ_k c_k * p^k * (1−p)^{m−k}
Sourcepub fn min_connected_edges(&self) -> usize
pub fn min_connected_edges(&self) -> usize
Return the minimum cut size (the lowest k with coeffs[k] > 0).
Sourcepub fn total_connected_subgraphs(&self) -> u64
pub fn total_connected_subgraphs(&self) -> u64
Return the total number of spanning subgraphs (sum of all coefficients).
Trait Implementations§
Source§impl Clone for ReliabilityPolynomial
impl Clone for ReliabilityPolynomial
Source§fn clone(&self) -> ReliabilityPolynomial
fn clone(&self) -> ReliabilityPolynomial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReliabilityPolynomial
impl RefUnwindSafe for ReliabilityPolynomial
impl Send for ReliabilityPolynomial
impl Sync for ReliabilityPolynomial
impl Unpin for ReliabilityPolynomial
impl UnsafeUnpin for ReliabilityPolynomial
impl UnwindSafe for ReliabilityPolynomial
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
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>
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>
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