Skip to content

Commit

Permalink
KG-4574: Allow replacing edges for faster diff manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
DGPardo committed Nov 1, 2024
1 parent 0da9758 commit 3b2b059
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ impl<Id: Hash + Eq + Copy, T: Default + AddAssign, W: Copy + PartialEq> GraphDif
Ok(())
}

/// # Safety
/// Does not check that the node IDs are valid (i.e. not marked as deleted).
/// CAUTION: This replaces existing diff edges by the provided ones.
pub unsafe fn set_edges_unchecked(&mut self, edges: HashMap<Id, HashMap<Id, W>>) {
let _ = std::mem::replace(&mut self.edges.new_or_updated, edges);
}

/// Add a new edge to be deleted to the diff.
/// If present, the edge is removed from `new_or_updated`.
pub fn delete_edge(&mut self, from: &Id, to: &Id) {
Expand Down

0 comments on commit 3b2b059

Please sign in to comment.