Skip to main content

AdaptiveGeoSpar

Struct AdaptiveGeoSpar 

Source
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 connectivity
  • scorer: random-walk importance estimator
  • auditor: 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

Source

pub fn new(config: SparsifierConfig) -> Self

Create a new empty sparsifier with the given configuration.

Source

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.

Source

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.

Source

pub fn handle_delete(&mut self, u: usize, v: usize) -> Result<()>

Handle the deletion of an edge from the full graph.

Source

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.

Source

pub fn run_audit(&self) -> AuditResult

Run a spectral audit comparing g_spec against g_full.

Source

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.

Source

pub fn full_graph(&self) -> &SparseGraph

Get a reference to the full graph.

Source

pub fn sparsifier_graph(&self) -> &SparseGraph

Get a reference to the current sparsifier graph.

Source

pub fn snapshot(&self) -> SparseGraph

Get a clone of the thread-safe sparsifier snapshot.

Source

pub fn config(&self) -> &SparsifierConfig

Get the current configuration.

Trait Implementations§

Source§

impl Debug for AdaptiveGeoSpar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Sparsifier for AdaptiveGeoSpar

Source§

fn insert_edge(&mut self, u: usize, v: usize, weight: f64) -> Result<()>

Insert an edge into the full graph and update the sparsifier.
Source§

fn delete_edge(&mut self, u: usize, v: usize) -> Result<()>

Delete an edge from the full graph and update the sparsifier.
Source§

fn audit(&self) -> AuditResult

Run a spectral audit comparing the sparsifier against the full graph.
Source§

fn rebuild_local(&mut self, nodes: &[usize]) -> Result<()>

Rebuild the sparsifier around specific vertices.
Source§

fn rebuild_full(&mut self) -> Result<()>

Fully reconstruct the sparsifier from scratch.
Source§

fn sparsifier(&self) -> &SparseGraph

Return a reference to the current sparsifier graph.
Source§

fn compression_ratio(&self) -> f64

Return the current compression ratio.
Source§

fn stats(&self) -> &SparsifierStats

Return the current statistics.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more