pub struct GraphDiffResult {
pub nodes_added: AHashSet<i64>,
pub nodes_removed: AHashSet<i64>,
pub edges_added: Vec<(i64, i64)>,
pub edges_removed: Vec<(i64, i64)>,
pub similarity_score: f64,
pub is_isomorphic: bool,
pub graph_edit_distance: f64,
pub graph1_size: usize,
pub graph2_size: usize,
}Expand description
Complete graph diff result with delta and similarity metrics.
Combines structural delta information (nodes/edges added/removed) with similarity metrics from Phase 54 to provide comprehensive diff analysis.
§Example
ⓘ
let diff = graph_diff(&graph1, &graph2)?;
println!("Nodes added: {}", diff.nodes_added.len());
println!("Nodes removed: {}", diff.nodes_removed.len());
println!("Similarity: {:.2}", diff.similarity_score);
if diff.is_safe() {
println!("Refactor is safe - no breaking changes");
}Fields§
§nodes_added: AHashSet<i64>Node changes
nodes_removed: AHashSet<i64>§edges_added: Vec<(i64, i64)>Edge changes
edges_removed: Vec<(i64, i64)>§similarity_score: f64Structural similarity metrics (from Phase 54)
is_isomorphic: bool§graph_edit_distance: f64§graph1_size: usizeGraph sizes for context
graph2_size: usizeImplementations§
Source§impl GraphDiffResult
impl GraphDiffResult
Sourcepub fn is_safe(&self) -> bool
pub fn is_safe(&self) -> bool
Returns true if the diff represents a safe refactor.
A refactor is considered “safe” if:
- No nodes were removed (doesn’t break existing code)
- Similarity score >= 0.8 (very similar structure)
§Example
ⓘ
if diff.is_safe() {
println!("Refactor is safe");
} else {
println!("Review changes before committing");
}Sourcepub fn has_breaking_changes(&self) -> bool
pub fn has_breaking_changes(&self) -> bool
Sourcepub fn total_changes(&self) -> usize
pub fn total_changes(&self) -> usize
Returns the total number of changes (nodes + edges).
Trait Implementations§
Source§impl Clone for GraphDiffResult
impl Clone for GraphDiffResult
Source§fn clone(&self) -> GraphDiffResult
fn clone(&self) -> GraphDiffResult
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 GraphDiffResult
impl RefUnwindSafe for GraphDiffResult
impl Send for GraphDiffResult
impl Sync for GraphDiffResult
impl Unpin for GraphDiffResult
impl UnwindSafe for GraphDiffResult
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