raphtory/db/graph/views/
is_deleted_graph.rs1use crate::{
2 db::{
3 api::{
4 properties::internal::InheritPropertiesOps,
5 view::internal::{
6 EdgeTimeSemanticsOps, Immutable, InheritEdgeFilterOps, InheritEdgeHistoryFilter,
7 InheritExplodedEdgeFilterOps, InheritLayerOps, InheritListOps, InheritMaterialize,
8 InheritNodeFilterOps, InheritNodeHistoryFilter, InheritStorageOps,
9 InheritTimeSemantics, InternalEdgeLayerFilterOps, Static,
10 },
11 },
12 graph::views::layer_graph::LayeredGraph,
13 },
14 prelude::GraphViewOps,
15};
16use raphtory_api::{core::entities::LayerIds, inherit::Base};
17use raphtory_storage::{core_ops::InheritCoreGraphOps, graph::edges::edge_ref::EdgeStorageRef};
18
19#[derive(Copy, Clone, Debug)]
20pub struct IsDeletedGraph<G> {
21 graph: G,
22}
23
24impl<'graph, G: GraphViewOps<'graph>> Base for IsDeletedGraph<G> {
25 type Base = G;
26
27 fn base(&self) -> &Self::Base {
28 &self.graph
29 }
30}
31
32impl<'graph, G: GraphViewOps<'graph>> IsDeletedGraph<G> {
33 pub fn new(graph: G) -> Self {
34 Self { graph }
35 }
36}
37
38impl<G> Static for IsDeletedGraph<G> {}
39impl<G> Immutable for IsDeletedGraph<G> {}
40impl<'graph, G: GraphViewOps<'graph>> InheritNodeHistoryFilter for IsDeletedGraph<G> {}
41impl<'graph, G: GraphViewOps<'graph>> InheritEdgeHistoryFilter for IsDeletedGraph<G> {}
42impl<'graph, G: GraphViewOps<'graph>> InheritStorageOps for IsDeletedGraph<G> {}
43impl<'graph, G: GraphViewOps<'graph>> InheritCoreGraphOps for IsDeletedGraph<G> {}
44impl<'graph, G: GraphViewOps<'graph>> InheritLayerOps for IsDeletedGraph<G> {}
45impl<'graph, G: GraphViewOps<'graph>> InheritListOps for IsDeletedGraph<G> {}
46impl<'graph, G: GraphViewOps<'graph>> InheritMaterialize for IsDeletedGraph<G> {}
47impl<'graph, G: GraphViewOps<'graph>> InheritPropertiesOps for IsDeletedGraph<G> {}
48
49impl<'graph, G: GraphViewOps<'graph>> InheritNodeFilterOps for IsDeletedGraph<G> {}
50
51impl<'graph, G: GraphViewOps<'graph>> InheritTimeSemantics for IsDeletedGraph<G> {}
52
53impl<'graph, G: GraphViewOps<'graph>> InheritEdgeFilterOps for IsDeletedGraph<G> {}
54
55impl<'graph, G: GraphViewOps<'graph>> InheritExplodedEdgeFilterOps for IsDeletedGraph<G> {}
56
57impl<'graph, G: GraphViewOps<'graph>> InternalEdgeLayerFilterOps for IsDeletedGraph<G> {
58 fn internal_edge_layer_filtered(&self) -> bool {
59 true
60 }
61
62 fn internal_layer_filter_edge_list_trusted(&self) -> bool {
63 false
64 }
65
66 fn internal_filter_edge_layer(&self, edge: EdgeStorageRef, layer: usize) -> bool {
67 let time_semantics = self.graph.edge_time_semantics();
68 time_semantics.edge_is_deleted(edge, LayeredGraph::new(&self.graph, LayerIds::One(layer)))
69 && self.graph.internal_filter_edge_layer(edge, layer)
70 }
71}