pub trait ProperCutInstance: Send + Sync {
// Required methods
fn init(graph: &DynamicGraph, lambda_min: u64, lambda_max: u64) -> Self
where Self: Sized;
fn apply_inserts(&mut self, edges: &[(EdgeId, VertexId, VertexId)]);
fn apply_deletes(&mut self, edges: &[(EdgeId, VertexId, VertexId)]);
fn query(&mut self) -> InstanceResult;
fn bounds(&self) -> (u64, u64);
}Expand description
A bounded-range proper cut instance
This trait defines the interface for maintaining minimum proper cuts over a dynamic graph, assuming the cut value λ remains within a bounded range [λ_min, λ_max].
§Proper Cuts
A proper cut is a partition (U, V \ U) where both U and V \ U induce connected subgraphs. This is stricter than a general cut.
§Bounded Range Assumption
The instance assumes λ ∈ [λ_min, λ_max]:
- If λ < λ_min: Undefined behavior
- If λ ∈ [λ_min, λ_max]: Returns
ValueInRangewith witness - If λ > λ_max: Returns
AboveRange
§Update Protocol
Updates must follow this order:
- Call
apply_inserts()with batch of insertions - Call
apply_deletes()with batch of deletions - Call
query()to get updated result
§Thread Safety
Implementations must be Send + Sync for use in parallel algorithms.
Required Methods§
Sourcefn init(graph: &DynamicGraph, lambda_min: u64, lambda_max: u64) -> Selfwhere
Self: Sized,
fn init(graph: &DynamicGraph, lambda_min: u64, lambda_max: u64) -> Selfwhere
Self: Sized,
Initialize instance on graph with given bounds
Creates a new instance that maintains minimum proper cuts for the given graph, assuming λ ∈ [λ_min, λ_max].
§Arguments
graph- The dynamic graph to operate onlambda_min- Minimum bound on the cut valuelambda_max- Maximum bound on the cut value
§Panics
May panic if λ_min > λ_max or if the graph is invalid.
Sourcefn apply_inserts(&mut self, edges: &[(EdgeId, VertexId, VertexId)])
fn apply_inserts(&mut self, edges: &[(EdgeId, VertexId, VertexId)])
Apply batch of edge insertions
Inserts a batch of edges into the maintained structure.
Must be called before apply_deletes() in each update round.
§Arguments
edges- Slice of (edge_id, source, target) tuples to insert
Sourcefn apply_deletes(&mut self, edges: &[(EdgeId, VertexId, VertexId)])
fn apply_deletes(&mut self, edges: &[(EdgeId, VertexId, VertexId)])
Apply batch of edge deletions
Deletes a batch of edges from the maintained structure.
Must be called after apply_inserts() in each update round.
§Arguments
edges- Slice of (edge_id, source, target) tuples to delete
Sourcefn query(&mut self) -> InstanceResult
fn query(&mut self) -> InstanceResult
Query current minimum proper cut
Returns the current minimum proper cut value and witness, or indicates that the cut value exceeds the maximum bound.
§Returns
ValueInRange { value, witness }if λ ∈ [λ_min, λ_max]AboveRangeif λ > λ_max
§Complexity
Typically O(1) to O(log n) depending on the data structure.