Skip to content

Commit

Permalink
fix latest time for windowed edges in GraphWithDeletions
Browse files Browse the repository at this point in the history
  • Loading branch information
ljeub-pometry committed Jan 11, 2024
1 parent 628ee18 commit 84b658c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions raphtory/src/db/graph/views/deletion_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,19 @@ impl TimeSemantics for GraphWithDeletions {
None => {
let entry = self.core_edge(e.pid());
if edge_alive_at_end(entry.deref(), w.end, &layer_ids) {
Some(w.end - 1)
} else {
self.edge_deletions(e, layer_ids).range(w).last_t()
return Some(w.end - 1);
}
entry
.updates_iter(&layer_ids)
.flat_map(|(_, additions, deletions)| {
let last_deletion = deletions.range(w.clone()).last()?;
if last_deletion.t() > &w.start || additions.active(w.clone()) {
Some(*last_deletion.t())
} else {
None
}
})
.max()
}
}
}
Expand Down Expand Up @@ -957,6 +966,9 @@ mod test_deletions {
let g = GraphWithDeletions::new();
let e = g.add_edge(0, 1, 2, NO_PROPS, None).unwrap();
e.delete(2, None).unwrap();
assert_eq!(e.at(2).earliest_time(), None);
assert_eq!(e.at(2).latest_time(), None);
assert!(e.at(2).is_deleted());
assert_eq!(e.latest_time(), Some(2));
e.add_updates(4, NO_PROPS, None).unwrap();
assert_eq!(e.latest_time(), Some(i64::MAX));
Expand Down

1 comment on commit 84b658c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 84b658c Previous: f9a583c Ratio
lotr_graph_window_100/has_node_nonexisting 24 ns/iter (± 4) 10 ns/iter (± 0) 2.40
lotr_graph_window_10/has_node_nonexisting 27 ns/iter (± 4) 10 ns/iter (± 0) 2.70

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.