Skip to content

Commit e8eb639

Browse files
committed
rid nodetypefilteredgraph
1 parent 76c817a commit e8eb639

File tree

5 files changed

+14
-771
lines changed

5 files changed

+14
-771
lines changed

raphtory/src/db/api/view/graph.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
views::{
2020
cached_view::CachedView,
2121
filter::{
22-
model::TryAsCompositeFilter, node_type_filtered_graph::NodeTypeFilteredGraph,
22+
model::TryAsCompositeFilter,
2323
},
2424
node_subgraph::NodeSubgraph,
2525
valid_graph::ValidGraph,
@@ -50,6 +50,8 @@ use raphtory_storage::{
5050
use rayon::prelude::*;
5151
use rustc_hash::FxHashSet;
5252
use std::sync::{atomic::Ordering, Arc};
53+
use crate::db::api::state::ops::NodeTypeFilterOp;
54+
use crate::db::graph::views::filter::node_filtered_graph::NodeFilteredGraph;
5355

5456
/// This trait GraphViewOps defines operations for accessing
5557
/// information about a graph. The trait has associated types
@@ -80,7 +82,7 @@ pub trait GraphViewOps<'graph>: BoxableGraphView + Sized + Clone + 'graph {
8082
fn subgraph_node_types<I: IntoIterator<Item = V>, V: AsRef<str>>(
8183
&self,
8284
nodes_types: I,
83-
) -> NodeTypeFilteredGraph<Self>;
85+
) -> NodeFilteredGraph<Self, NodeTypeFilterOp>;
8486

8587
fn exclude_nodes<I: IntoIterator<Item = V>, V: AsNodeRef>(
8688
&self,
@@ -443,10 +445,8 @@ impl<'graph, G: GraphView + 'graph> GraphViewOps<'graph> for G {
443445
fn subgraph_node_types<I: IntoIterator<Item = V>, V: AsRef<str>>(
444446
&self,
445447
node_types: I,
446-
) -> NodeTypeFilteredGraph<Self> {
447-
let node_types_filter =
448-
create_node_type_filter(self.node_meta().node_type_meta(), node_types);
449-
NodeTypeFilteredGraph::new(self.clone(), node_types_filter)
448+
) -> NodeFilteredGraph<Self, NodeTypeFilterOp> {
449+
NodeFilteredGraph::new(self.clone(), NodeTypeFilterOp::new_from_values(node_types, self))
450450
}
451451

452452
fn exclude_nodes<I: IntoIterator<Item = V>, V: AsNodeRef>(&self, nodes: I) -> NodeSubgraph<G> {

raphtory/src/db/graph/views/filter/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub mod exploded_edge_property_filter;
55
pub(crate) mod internal;
66
pub mod model;
77
pub(crate) mod node_filtered_graph;
8-
pub mod node_type_filtered_graph;
98
pub mod not_filtered_graph;
109
pub mod or_filtered_graph;
1110

raphtory/src/db/graph/views/filter/model/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::db::graph::views::filter::model::node_filter::{
66
InternalNodeFilterBuilderOps, InternalNodeIdFilterBuilderOps,
77
};
88
use crate::db::graph::views::filter::model::property_filter::{
9-
CombinedFilter, InternalPropertyFilterBuilderOps, Op, OpChainBuilder, PropertyFilterOps,
9+
CombinedFilter, InternalPropertyFilterBuilderOps, OpChainBuilder, PropertyFilterOps,
1010
PropertyRef,
1111
};
1212
use crate::db::graph::views::window_graph::WindowedGraph;

raphtory/src/db/graph/views/filter/model/node_filter.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::db::api::state::ops::filter::NodeNameFilterOp;
12
use crate::{
23
db::{
34
api::{
@@ -19,7 +20,6 @@ use crate::{
1920
Filter, FilterValue, NotFilter, OrFilter, TryAsCompositeFilter, Windowed, Wrap,
2021
},
2122
node_filtered_graph::NodeFilteredGraph,
22-
node_type_filtered_graph::NodeTypeFilteredGraph,
2323
},
2424
},
2525
errors::GraphError,
@@ -28,7 +28,6 @@ use crate::{
2828
use raphtory_api::core::entities::{GidType, GID};
2929
use raphtory_core::utils::time::IntoTime;
3030
use std::{fmt, fmt::Display, ops::Deref, sync::Arc};
31-
use crate::db::api::state::ops::filter::NodeNameFilterOp;
3231

3332
#[derive(Debug, Clone)]
3433
pub struct NodeIdFilter(pub Filter);
@@ -82,7 +81,7 @@ impl From<Filter> for NodeNameFilter {
8281
}
8382

8483
impl CreateFilter for NodeNameFilter {
85-
type EntityFiltered<'graph, G: GraphViewOps<'graph>> = NodeFilteredGraph<G,NodeNameFilterOp>;
84+
type EntityFiltered<'graph, G: GraphViewOps<'graph>> = NodeFilteredGraph<G, NodeNameFilterOp>;
8685

8786
type NodeFilter<'graph, G: GraphView + 'graph> = NodeNameFilterOp;
8887

@@ -117,7 +116,7 @@ impl From<Filter> for NodeTypeFilter {
117116
}
118117

119118
impl CreateFilter for NodeTypeFilter {
120-
type EntityFiltered<'graph, G: GraphViewOps<'graph>> = NodeTypeFilteredGraph<G>;
119+
type EntityFiltered<'graph, G: GraphViewOps<'graph>> = NodeFilteredGraph<G, NodeTypeFilterOp>;
121120

122121
type NodeFilter<'graph, G: GraphView + 'graph> = NodeTypeFilterOp;
123122

@@ -132,7 +131,10 @@ impl CreateFilter for NodeTypeFilter {
132131
.iter()
133132
.map(|k| self.0.matches(Some(k))) // TODO: _default check
134133
.collect::<Vec<_>>();
135-
Ok(NodeTypeFilteredGraph::new(graph, node_types_filter.into()))
134+
Ok(NodeFilteredGraph::new(
135+
graph,
136+
TypeId.mask(node_types_filter.into()),
137+
))
136138
}
137139

138140
fn create_node_filter<'graph, G: GraphView + 'graph>(

0 commit comments

Comments
 (0)