Skip to content

Commit

Permalink
chore: Optimizes least_common_parents
Browse files Browse the repository at this point in the history
  • Loading branch information
andyquinterom committed Jun 18, 2024
1 parent 4e4f7ef commit dfcf695
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/directed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,18 @@ impl DirectedGraph {
) -> GraphInteractionResult<Vec<&str>> {
// Declare used buffers
let selected_buf = unsafe { self.u32x1_vec_0() };
let selected_buf_set = unsafe { self.u32x1_set_0() };
let parents = unsafe { self.u32x1_vec_1() };
let least_common_parents = unsafe { self.u32x1_vec_2() };

self.get_internal_mul(selected, selected_buf)?;
selected_buf_set.extend(selected_buf.iter().copied());

selected_buf.iter().for_each(|&child| {
self.parents_u32(&[child], parents);
let parent_not_in_selection = parents
.drain(..)
.any(|parent| selected_buf.contains(&parent))
.any(|parent| selected_buf_set.contains(&parent))
.not();
if parent_not_in_selection {
least_common_parents.push(child);
Expand Down

0 comments on commit dfcf695

Please sign in to comment.