pub struct AdaptiveGeoSpar { /* private fields */ }Expand description
Dynamic spectral graph sparsifier implementing the ADKKP16 approach.
Maintains:
g_full: the full weighted graph (receives all updates)g_spec: the compressed sparsifier (~O(n log n / eps^2) edges)backbone: spanning forest guaranteeing connectivityscorer: random-walk importance estimatorauditor: periodic spectral quality check
§Thread safety
The sparsifier wraps its state in RwLock internally. The public API
takes &mut self to make ownership clear; concurrent readers can
access the sparsifier graph via sparsifier which
clones the current snapshot.
Implementations§
Source§impl AdaptiveGeoSpar
impl AdaptiveGeoSpar
Sourcepub fn new(config: SparsifierConfig) -> Self
pub fn new(config: SparsifierConfig) -> Self
Create a new empty sparsifier with the given configuration.
Sourcepub fn build(graph: &SparseGraph, config: SparsifierConfig) -> Result<Self>
pub fn build(graph: &SparseGraph, config: SparsifierConfig) -> Result<Self>
Build a sparsifier from an existing static graph.
This is the primary entry point for initial construction. It scores all edges, samples according to importance, and sets up the backbone.
Sourcepub fn handle_insert(&mut self, u: usize, v: usize, weight: f64) -> Result<()>
pub fn handle_insert(&mut self, u: usize, v: usize, weight: f64) -> Result<()>
Handle the insertion of an edge into the full graph.
The edge is added to g_full, the backbone is updated, and the
sparsifier is incrementally updated. Periodic audits may trigger
a local or full rebuild.
Sourcepub fn handle_delete(&mut self, u: usize, v: usize) -> Result<()>
pub fn handle_delete(&mut self, u: usize, v: usize) -> Result<()>
Handle the deletion of an edge from the full graph.
Sourcepub fn update_embedding(
&mut self,
node: usize,
old_neighbors: &[(usize, f64)],
new_neighbors: &[(usize, f64)],
) -> Result<()>
pub fn update_embedding( &mut self, node: usize, old_neighbors: &[(usize, f64)], new_neighbors: &[(usize, f64)], ) -> Result<()>
Handle a point-move operation: a node’s neighbourhood changes.
old_neighbors are edges to remove, new_neighbors are edges to add.
Sourcepub fn run_audit(&self) -> AuditResult
pub fn run_audit(&self) -> AuditResult
Run a spectral audit comparing g_spec against g_full.
Sourcepub fn do_local_rebuild(&mut self, nodes: &[usize]) -> Result<()>
pub fn do_local_rebuild(&mut self, nodes: &[usize]) -> Result<()>
Rebuild the sparsifier around specific vertices.
Re-scores and re-samples edges incident to the given nodes.
Sourcepub fn full_graph(&self) -> &SparseGraph
pub fn full_graph(&self) -> &SparseGraph
Get a reference to the full graph.
Sourcepub fn sparsifier_graph(&self) -> &SparseGraph
pub fn sparsifier_graph(&self) -> &SparseGraph
Get a reference to the current sparsifier graph.
Sourcepub fn snapshot(&self) -> SparseGraph
pub fn snapshot(&self) -> SparseGraph
Get a clone of the thread-safe sparsifier snapshot.
Sourcepub fn config(&self) -> &SparsifierConfig
pub fn config(&self) -> &SparsifierConfig
Get the current configuration.
Trait Implementations§
Source§impl Debug for AdaptiveGeoSpar
impl Debug for AdaptiveGeoSpar
Source§impl Sparsifier for AdaptiveGeoSpar
impl Sparsifier for AdaptiveGeoSpar
Source§fn insert_edge(&mut self, u: usize, v: usize, weight: f64) -> Result<()>
fn insert_edge(&mut self, u: usize, v: usize, weight: f64) -> Result<()>
Source§fn delete_edge(&mut self, u: usize, v: usize) -> Result<()>
fn delete_edge(&mut self, u: usize, v: usize) -> Result<()>
Source§fn audit(&self) -> AuditResult
fn audit(&self) -> AuditResult
Source§fn rebuild_local(&mut self, nodes: &[usize]) -> Result<()>
fn rebuild_local(&mut self, nodes: &[usize]) -> Result<()>
Source§fn rebuild_full(&mut self) -> Result<()>
fn rebuild_full(&mut self) -> Result<()>
Source§fn sparsifier(&self) -> &SparseGraph
fn sparsifier(&self) -> &SparseGraph
Source§fn compression_ratio(&self) -> f64
fn compression_ratio(&self) -> f64
Source§fn stats(&self) -> &SparsifierStats
fn stats(&self) -> &SparsifierStats
Auto Trait Implementations§
impl !Freeze for AdaptiveGeoSpar
impl !RefUnwindSafe for AdaptiveGeoSpar
impl Send for AdaptiveGeoSpar
impl Sync for AdaptiveGeoSpar
impl Unpin for AdaptiveGeoSpar
impl UnsafeUnpin for AdaptiveGeoSpar
impl UnwindSafe for AdaptiveGeoSpar
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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