pub struct Graph<F: SemiflowFloat = f64> { /* private fields */ }Expand description
Frozen sparse weighted graph in symmetric CSR layout. See ADR-0048.
Immutable post-construction — no mutator methods. Invariants I1–I7 hold.
Implementations§
Source§impl<F: SemiflowFloat> Graph<F>
impl<F: SemiflowFloat> Graph<F>
Sourcepub fn n_directed_edges(&self) -> usize
pub fn n_directed_edges(&self) -> usize
Number of directed edge-entries stored (= 2 · undirected_edges).
Sourcepub fn cycle(n: usize) -> Self
pub fn cycle(n: usize) -> Self
Cycle graph: path graph plus edge (n − 1) — 0, all unit weights.
§Panics
Panics if n < 3 (cycle on 1 or 2 nodes is degenerate).
Sourcepub fn from_edges(
n_nodes: usize,
edges: impl IntoIterator<Item = (u32, u32, F)>,
) -> Result<Self, SemiflowError>
pub fn from_edges( n_nodes: usize, edges: impl IntoIterator<Item = (u32, u32, F)>, ) -> Result<Self, SemiflowError>
Build from an iterator of undirected edges (u, v, w).
§Errors
SemiflowError::DomainViolation: self-loop, node out of range, bad weight,
duplicate edge, or a weighted degree dᵢ that overflows to ∞ (it is the
combinatorial Laplacian’s diagonal entry).
Sourcepub fn erdos_renyi(n_nodes: usize, p: f64, seed: u64) -> Self
pub fn erdos_renyi(n_nodes: usize, p: f64, seed: u64) -> Self
Erdős–Rényi G(n_nodes, p) with seeded splitmix64 RNG. All weights = 1.
Auto Trait Implementations§
impl<F> Freeze for Graph<F>
impl<F> RefUnwindSafe for Graph<F>where
Vec<F>: RefUnwindSafe,
impl<F> Send for Graph<F>
impl<F> Sync for Graph<F>
impl<F> Unpin for Graph<F>
impl<F> UnsafeUnpin for Graph<F>where
Vec<F>: UnsafeUnpin,
impl<F> UnwindSafe for Graph<F>where
Vec<F>: UnwindSafe,
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