pub struct ReplacementEdgeIndex { /* private fields */ }Expand description
Level-based replacement edge index for O(log n) lookup
Organizes non-tree edges by level, enabling efficient replacement edge discovery when tree edges are deleted.
§Complexity
- Lookup: O(log n) amortized
- Insert: O(log n)
- Delete: O(log n)
Implementations§
Source§impl ReplacementEdgeIndex
impl ReplacementEdgeIndex
Sourcepub fn add_tree_edge(&mut self, u: VertexId, v: VertexId)
pub fn add_tree_edge(&mut self, u: VertexId, v: VertexId)
Add a tree edge
Sourcepub fn remove_tree_edge(&mut self, u: VertexId, v: VertexId) -> bool
pub fn remove_tree_edge(&mut self, u: VertexId, v: VertexId) -> bool
Remove a tree edge (returns if it was present)
Sourcepub fn add_non_tree_edge(&mut self, u: VertexId, v: VertexId)
pub fn add_non_tree_edge(&mut self, u: VertexId, v: VertexId)
Add a non-tree edge at level 0
Sourcepub fn remove_non_tree_edge(&mut self, u: VertexId, v: VertexId)
pub fn remove_non_tree_edge(&mut self, u: VertexId, v: VertexId)
Remove a non-tree edge
Sourcepub fn find_replacement(
&mut self,
u: VertexId,
v: VertexId,
tree_adjacency: &HashMap<VertexId, HashSet<VertexId>>,
) -> Option<EdgeKey>
pub fn find_replacement( &mut self, u: VertexId, v: VertexId, tree_adjacency: &HashMap<VertexId, HashSet<VertexId>>, ) -> Option<EdgeKey>
Find a replacement edge for deleted tree edge (u, v)
Returns Some((x, y)) if a replacement exists, None if components disconnect.
§Complexity
O(log n) amortized through level-based search
Sourcepub fn find_replacement_fast(
&self,
smaller_component: &HashSet<VertexId>,
) -> Option<EdgeKey>
pub fn find_replacement_fast( &self, smaller_component: &HashSet<VertexId>, ) -> Option<EdgeKey>
Fast replacement lookup when components are already known
§Complexity
O(log n) - binary search through levels
Sourcepub fn stats(&self) -> ReplacementIndexStats
pub fn stats(&self) -> ReplacementIndexStats
Get statistics about the index
Trait Implementations§
Source§impl Clone for ReplacementEdgeIndex
impl Clone for ReplacementEdgeIndex
Source§fn clone(&self) -> ReplacementEdgeIndex
fn clone(&self) -> ReplacementEdgeIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ReplacementEdgeIndex
impl RefUnwindSafe for ReplacementEdgeIndex
impl Send for ReplacementEdgeIndex
impl Sync for ReplacementEdgeIndex
impl Unpin for ReplacementEdgeIndex
impl UnwindSafe for ReplacementEdgeIndex
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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