pub struct ExpanderChecker {
pub graph: UndirectedGraph,
}Expand description
Checks expansion properties of a graph using an approximation of the Cheeger constant.
The Cheeger constant h(G) = min_{S: 0<|S|≤n/2} |∂S| / |S|. This checker approximates it by trying all subsets up to a given size limit.
Fields§
§graph: UndirectedGraphThe underlying undirected graph.
Implementations§
Source§impl ExpanderChecker
impl ExpanderChecker
Sourcepub fn new(graph: UndirectedGraph) -> Self
pub fn new(graph: UndirectedGraph) -> Self
Create from an existing undirected graph.
Sourcepub fn edge_boundary(&self, subset: &[usize]) -> usize
pub fn edge_boundary(&self, subset: &[usize]) -> usize
Compute the edge boundary |∂S| = edges with exactly one endpoint in S.
Sourcepub fn approximate_cheeger(&self) -> f64
pub fn approximate_cheeger(&self) -> f64
Approximate Cheeger constant: try all subsets of size 1..=n/2 (only feasible for small n). Returns the approximate h(G) as a rational approximation (boundary/size).
Sourcepub fn is_expander(&self, threshold: f64) -> bool
pub fn is_expander(&self, threshold: f64) -> bool
Returns true if the graph is an h-vertex expander: h(G) ≥ threshold.
Auto Trait Implementations§
impl Freeze for ExpanderChecker
impl RefUnwindSafe for ExpanderChecker
impl Send for ExpanderChecker
impl Sync for ExpanderChecker
impl Unpin for ExpanderChecker
impl UnsafeUnpin for ExpanderChecker
impl UnwindSafe for ExpanderChecker
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