pub struct Validator<'a> { /* private fields */ }Expand description
Validator for graph integrity.
Implementations§
Source§impl<'a> Validator<'a>
impl<'a> Validator<'a>
pub fn new(graph: &'a Graph) -> Self
Sourcepub fn validate(&self) -> ValidationResult
pub fn validate(&self) -> ValidationResult
Run all validations and return combined result.
Sourcepub fn find_orphan_nodes(&self) -> Vec<String>
pub fn find_orphan_nodes(&self) -> Vec<String>
Find nodes that have no edges (neither incoming nor outgoing).
Sourcepub fn find_missing_refs(&self) -> Vec<MissingRef>
pub fn find_missing_refs(&self) -> Vec<MissingRef>
Find edges that reference non-existent nodes.
Sourcepub fn find_cycles(&self) -> Vec<Vec<String>>
pub fn find_cycles(&self) -> Vec<Vec<String>>
Find cycles in the graph using Tarjan’s SCC algorithm. By default checks depends_on edges. Any SCC with size > 1 is a cycle.
Sourcepub fn find_cycles_for_relations(&self, relations: &[&str]) -> Vec<Vec<String>>
pub fn find_cycles_for_relations(&self, relations: &[&str]) -> Vec<Vec<String>>
Find cycles considering specific edge relations.
Sourcepub fn find_duplicate_nodes(&self) -> Vec<String>
pub fn find_duplicate_nodes(&self) -> Vec<String>
Find duplicate node IDs.
Sourcepub fn find_duplicate_edges(&self) -> Vec<DuplicateEdge>
pub fn find_duplicate_edges(&self) -> Vec<DuplicateEdge>
Find duplicate edges (same from, to, relation).
Sourcepub fn find_self_edges(&self) -> Vec<SelfEdge>
pub fn find_self_edges(&self) -> Vec<SelfEdge>
Find self-referential edges (from == to).
Sourcepub fn would_create_cycle(&self, from: &str, to: &str) -> bool
pub fn would_create_cycle(&self, from: &str, to: &str) -> bool
Check if adding an edge would create a cycle.
Auto Trait Implementations§
impl<'a> Freeze for Validator<'a>
impl<'a> RefUnwindSafe for Validator<'a>
impl<'a> Send for Validator<'a>
impl<'a> Sync for Validator<'a>
impl<'a> Unpin for Validator<'a>
impl<'a> UnsafeUnpin for Validator<'a>
impl<'a> UnwindSafe for Validator<'a>
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