pub struct SlidingWindowGraph { /* private fields */ }Expand description
A sliding window graph that maintains only the most recent W edges.
As new edges arrive, old edges beyond the window are automatically evicted. This is useful for maintaining a graph over a time-bounded stream.
Implementations§
Source§impl SlidingWindowGraph
impl SlidingWindowGraph
Sourcepub fn process_edge(&mut self, src: usize, dst: usize, weight: f64)
pub fn process_edge(&mut self, src: usize, dst: usize, weight: f64)
Process a new edge. If the window is full, the oldest edge is evicted.
Sourcepub fn window_size(&self) -> usize
pub fn window_size(&self) -> usize
Get the window size.
Sourcepub fn neighbors(&self, node: usize) -> Vec<(usize, f64)>
pub fn neighbors(&self, node: usize) -> Vec<(usize, f64)>
Get neighbors of a node in the current window.
Sourcepub fn has_edge(&self, src: usize, dst: usize) -> bool
pub fn has_edge(&self, src: usize, dst: usize) -> bool
Check if an edge exists in the current window.
Sourcepub fn events_processed(&self) -> u64
pub fn events_processed(&self) -> u64
Get total events processed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SlidingWindowGraph
impl RefUnwindSafe for SlidingWindowGraph
impl Send for SlidingWindowGraph
impl Sync for SlidingWindowGraph
impl Unpin for SlidingWindowGraph
impl UnsafeUnpin for SlidingWindowGraph
impl UnwindSafe for SlidingWindowGraph
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