pub struct UnionFind { /* private fields */ }Expand description
Union-Find data structure for tracking connected components in a call graph.
Invariant: parent.len() == rank.len() == nodes.len()
Invariant: parent[i] < parent.len() for all valid i
Implementations§
Source§impl UnionFind
impl UnionFind
pub fn new() -> Self
Sourcepub fn add_node(&mut self, file_index: u16, name: &str, kind: NodeKind) -> u32
pub fn add_node(&mut self, file_index: u16, name: &str, kind: NodeKind) -> u32
Add a node. Returns existing ID if (file_index, name) already present.
Sourcepub fn component_count(&mut self) -> usize
pub fn component_count(&mut self) -> usize
Count distinct connected components among file-kind nodes only.
Sourcepub fn get_components(&mut self) -> Vec<Vec<u16>>
pub fn get_components(&mut self) -> Vec<Vec<u16>>
Return file indices grouped by component.
Sourcepub fn get_node(&self, id: u32) -> Option<&NodeDescriptor>
pub fn get_node(&self, id: u32) -> Option<&NodeDescriptor>
Get the node descriptor for a given ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UnionFind
impl RefUnwindSafe for UnionFind
impl Send for UnionFind
impl Sync for UnionFind
impl Unpin for UnionFind
impl UnsafeUnpin for UnionFind
impl UnwindSafe for UnionFind
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