pub trait StreamingAlgorithm<T> {
// Required methods
fn initialize(
&mut self,
processor: &IncrementalGraphProcessor,
) -> Result<()>;
fn update(
&mut self,
processor: &IncrementalGraphProcessor,
changes: &UpdateResult,
) -> Result<()>;
fn get_result(&self) -> &T;
fn recompute(&mut self, processor: &IncrementalGraphProcessor) -> Result<()>;
fn needs_recomputation(&self, changes: &UpdateResult) -> bool;
}
Expand description
Streaming algorithms that can update incrementally as the graph changes These algorithms maintain state and update efficiently rather than recomputing from scratch
Required Methods§
Sourcefn initialize(&mut self, processor: &IncrementalGraphProcessor) -> Result<()>
fn initialize(&mut self, processor: &IncrementalGraphProcessor) -> Result<()>
Initialize the algorithm with the current graph state
Sourcefn update(
&mut self,
processor: &IncrementalGraphProcessor,
changes: &UpdateResult,
) -> Result<()>
fn update( &mut self, processor: &IncrementalGraphProcessor, changes: &UpdateResult, ) -> Result<()>
Update the algorithm state based on graph changes
Sourcefn get_result(&self) -> &T
fn get_result(&self) -> &T
Get the current result/state of the algorithm
Sourcefn recompute(&mut self, processor: &IncrementalGraphProcessor) -> Result<()>
fn recompute(&mut self, processor: &IncrementalGraphProcessor) -> Result<()>
Force a full recomputation (fallback when incremental update is not sufficient)
Sourcefn needs_recomputation(&self, changes: &UpdateResult) -> bool
fn needs_recomputation(&self, changes: &UpdateResult) -> bool
Check if the algorithm needs full recomputation