pub struct MascotTriangleCounter { /* private fields */ }Expand description
MASCOT (Memory-efficient Accurate Sampling for Counting Local Triangles) streaming triangle counter.
Maintains a fixed-size edge reservoir sample and updates triangle counts as new edges arrive. More memory-efficient than Doulion for fixed memory budgets.
§Reference
Lim & Kang, “MASCOT: Memory-efficient and Accurate Sampling for Counting Local Triangles in Graph Streams”, KDD 2015.
Implementations§
Source§impl MascotTriangleCounter
impl MascotTriangleCounter
Sourcepub fn new(max_edges: usize, seed: u64) -> Self
pub fn new(max_edges: usize, seed: u64) -> Self
Create a new MASCOT counter with a fixed edge budget.
Sourcepub fn process_edge(&mut self, src: usize, dst: usize)
pub fn process_edge(&mut self, src: usize, dst: usize)
Process a new edge from the stream.
Sourcepub fn estimated_triangles(&self) -> f64
pub fn estimated_triangles(&self) -> f64
Get the estimated triangle count.
Sourcepub fn stats(&self) -> TriangleCounterStats
pub fn stats(&self) -> TriangleCounterStats
Get counter statistics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MascotTriangleCounter
impl RefUnwindSafe for MascotTriangleCounter
impl Send for MascotTriangleCounter
impl Sync for MascotTriangleCounter
impl Unpin for MascotTriangleCounter
impl UnsafeUnpin for MascotTriangleCounter
impl UnwindSafe for MascotTriangleCounter
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
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>
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 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>
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