Skip to content

Commit b7e9eae

Browse files
committed
changes
1 parent d825be9 commit b7e9eae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1052
-641
lines changed

raphtory-graphql/src/model/graph/edges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use dynamic_graphql::{ResolvedObject, ResolvedObjectFields};
1515
use itertools::Itertools;
1616
use raphtory::{
1717
db::{
18-
api::view::{internal::BaseFilter, DynamicGraph, IterFilterOps},
18+
api::view::{internal::Filter, DynamicGraph, IterFilterOps},
1919
graph::{edges::Edges, views::filter::model::edge_filter::CompositeEdgeFilter},
2020
},
2121
errors::GraphError,

raphtory-graphql/src/model/graph/filtering.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,11 +873,12 @@ fn build_windowed_property_filter_from_condition<M: Clone + Send + Sync + 'stati
873873
cond: &PropCondition,
874874
start: i64,
875875
end: i64,
876+
marker: M,
876877
) -> Result<PropertyFilter<Windowed<M>>, GraphError> {
877878
build_property_filter_from_condition_with_entity::<Windowed<M>>(
878879
prop_ref,
879880
cond,
880-
Windowed::from_times(start, end),
881+
Windowed::from_times(start, end, marker),
881882
)
882883
}
883884

@@ -949,11 +950,12 @@ impl TryFrom<GqlNodeFilter> for CompositeNodeFilter {
949950
GqlNodeFilter::TemporalProperty(prop) => {
950951
let prop_ref = PropertyRef::TemporalProperty(prop.name);
951952
if let Some(w) = prop.window {
952-
let pf = build_windowed_property_filter_from_condition::<NodeFilter>(
953+
let pf = build_windowed_property_filter_from_condition(
953954
prop_ref,
954955
&prop.where_,
955956
w.start,
956957
w.end,
958+
NodeFilter
957959
)?;
958960
return Ok(CompositeNodeFilter::PropertyWindowed(pf));
959961
}
@@ -1060,8 +1062,8 @@ impl TryFrom<GqlEdgeFilter> for CompositeEdgeFilter {
10601062
GqlEdgeFilter::TemporalProperty(p) => {
10611063
let prop_ref = PropertyRef::TemporalProperty(p.name);
10621064
if let Some(w) = p.window {
1063-
let pf = build_windowed_property_filter_from_condition::<EdgeFilter>(
1064-
prop_ref, &p.where_, w.start, w.end,
1065+
let pf = build_windowed_property_filter_from_condition(
1066+
prop_ref, &p.where_, w.start, w.end, EdgeFilter
10651067
)?;
10661068
return Ok(CompositeEdgeFilter::PropertyWindowed(pf));
10671069
}

raphtory/src/algorithms/components/in_components.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ where
7474
|_, _, _, local: Vec<InState>| {
7575
NodeState::new_from_eval_mapped(g.clone(), local, |v| {
7676
Nodes::new_filtered(
77+
g.clone(),
7778
g.clone(),
7879
Const(true),
7980
Some(Index::from_iter(v.in_components)),

raphtory/src/algorithms/components/out_components.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ where
7474
|_, _, _, local: Vec<OutState>| {
7575
NodeState::new_from_eval_mapped(g.clone(), local, |v| {
7676
Nodes::new_filtered(
77+
g.clone(),
7778
g.clone(),
7879
Const(true),
7980
Some(Index::from_iter(v.out_components)),

raphtory/src/algorithms/pathing/dijkstra.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ pub fn dijkstra_single_source_shortest_paths<G: StaticGraphViewOps, T: AsNodeRef
189189
let (index, values): (IndexSet<_, ahash::RandomState>, Vec<_>) = paths
190190
.into_iter()
191191
.map(|(id, (cost, path))| {
192-
let nodes = Nodes::new_filtered(g.clone(), NO_FILTER, Some(Index::new(path)));
192+
let nodes =
193+
Nodes::new_filtered(g.clone(), g.clone(), NO_FILTER, Some(Index::new(path)));
193194
(id, (cost, nodes))
194195
})
195196
.unzip();

raphtory/src/algorithms/pathing/single_source_shortest_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn single_source_shortest_path<'graph, G: GraphViewOps<'graph>, T: AsNodeRef
5858
}
5959
}
6060
NodeState::new_from_map(g.clone(), paths, |v| {
61-
Nodes::new_filtered(g.clone(), NO_FILTER, Some(Index::from_iter(v)))
61+
Nodes::new_filtered(g.clone(), g.clone(), NO_FILTER, Some(Index::from_iter(v)))
6262
})
6363
}
6464

raphtory/src/db/api/state/group_by.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ impl<'graph, V: Hash + Eq + Send + Sync + Clone, G: GraphViewOps<'graph>> NodeGr
3737
self.groups.iter().map(|(v, nodes)| {
3838
(
3939
v,
40-
Nodes::new_filtered(self.graph.clone(), Const(true), Some(nodes.clone())),
40+
Nodes::new_filtered(
41+
self.graph.clone(),
42+
self.graph.clone(),
43+
Const(true),
44+
Some(nodes.clone()),
45+
),
4146
)
4247
})
4348
}
@@ -78,7 +83,12 @@ impl<'graph, V: Hash + Eq + Send + Sync + Clone, G: GraphViewOps<'graph>> NodeGr
7883
self.groups.get(index).map(|(v, nodes)| {
7984
(
8085
v,
81-
Nodes::new_filtered(self.graph.clone(), Const(true), Some(nodes.clone())),
86+
Nodes::new_filtered(
87+
self.graph.clone(),
88+
self.graph.clone(),
89+
Const(true),
90+
Some(nodes.clone()),
91+
),
8292
)
8393
})
8494
}
@@ -105,14 +115,14 @@ impl<'graph, V: Hash + Eq + Send + Sync + Clone, G: GraphViewOps<'graph>> NodeGr
105115
}
106116

107117
pub trait NodeStateGroupBy<'graph>: NodeStateOps<'graph> {
108-
fn groups(&self) -> NodeGroups<Self::OwnedValue, Self::BaseGraph>;
118+
fn groups(&self) -> NodeGroups<Self::OwnedValue, Self::Graph>;
109119
}
110120

111121
impl<'graph, S: NodeStateOps<'graph>> NodeStateGroupBy<'graph> for S
112122
where
113123
S::OwnedValue: Hash + Eq + Debug,
114124
{
115-
fn groups(&self) -> NodeGroups<Self::OwnedValue, Self::BaseGraph> {
125+
fn groups(&self) -> NodeGroups<Self::OwnedValue, Self::Graph> {
116126
self.group_by(|v| v.clone())
117127
}
118128
}

raphtory/src/db/api/state/lazy_node_state.rs

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ use std::{
2323
};
2424

2525
#[derive(Clone)]
26-
pub struct LazyNodeState<'graph, Op, G, GH = Const<bool>> {
27-
nodes: Nodes<'graph, G, GH>,
26+
pub struct LazyNodeState<'graph, Op, G, GH, F = Const<bool>> {
27+
nodes: Nodes<'graph, G, GH, F>,
2828
pub(crate) op: Op,
2929
}
3030

3131
impl<
3232
'graph,
3333
O: NodeOp + 'graph,
3434
G: GraphViewOps<'graph>,
35-
GH: NodeFilterOp + Clone + 'graph,
35+
GH: GraphViewOps<'graph>,
36+
F: NodeFilterOp + Clone + 'graph,
3637
RHS,
37-
> PartialEq<&[RHS]> for LazyNodeState<'graph, O, G, GH>
38+
> PartialEq<&[RHS]> for LazyNodeState<'graph, O, G, GH, F>
3839
where
3940
O::Output: PartialEq<RHS>,
4041
{
@@ -47,10 +48,11 @@ impl<
4748
'graph,
4849
O: NodeOp + 'graph,
4950
G: GraphViewOps<'graph>,
50-
GH: NodeFilterOp + Clone + 'graph,
51+
GH: GraphViewOps<'graph>,
52+
F: NodeFilterOp + Clone + 'graph,
5153
RHS,
5254
const N: usize,
53-
> PartialEq<[RHS; N]> for LazyNodeState<'graph, O, G, GH>
55+
> PartialEq<[RHS; N]> for LazyNodeState<'graph, O, G, GH, F>
5456
where
5557
O::Output: PartialEq<RHS>,
5658
{
@@ -63,9 +65,10 @@ impl<
6365
'graph,
6466
O: NodeOp + 'graph,
6567
G: GraphViewOps<'graph>,
66-
GH: NodeFilterOp + Clone + 'graph,
68+
GH: GraphViewOps<'graph>,
69+
F: NodeFilterOp + Clone + 'graph,
6770
RHS: NodeStateOps<'graph, OwnedValue = O::Output>,
68-
> PartialEq<RHS> for LazyNodeState<'graph, O, G, GH>
71+
> PartialEq<RHS> for LazyNodeState<'graph, O, G, GH, F>
6972
where
7073
O::Output: PartialEq,
7174
{
@@ -84,9 +87,10 @@ impl<
8487
'graph,
8588
O: NodeOp + 'graph,
8689
G: GraphViewOps<'graph>,
87-
GH: NodeFilterOp + Clone + 'graph,
90+
GH: GraphViewOps<'graph>,
91+
F: NodeFilterOp + Clone + 'graph,
8892
RHS,
89-
> PartialEq<Vec<RHS>> for LazyNodeState<'graph, O, G, GH>
93+
> PartialEq<Vec<RHS>> for LazyNodeState<'graph, O, G, GH, F>
9094
where
9195
O::Output: PartialEq<RHS>,
9296
{
@@ -95,8 +99,13 @@ where
9599
}
96100
}
97101

98-
impl<'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'graph, O: NodeOp + 'graph> Debug
99-
for LazyNodeState<'graph, O, G, GH>
102+
impl<
103+
'graph,
104+
G: GraphViewOps<'graph>,
105+
GH: GraphViewOps<'graph>,
106+
F: NodeFilterOp + 'graph,
107+
O: NodeOp + 'graph,
108+
> Debug for LazyNodeState<'graph, O, G, GH, F>
100109
where
101110
O::Output: Debug,
102111
{
@@ -105,10 +114,15 @@ where
105114
}
106115
}
107116

108-
impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clone + 'graph>
109-
IntoIterator for LazyNodeState<'graph, O, G, GH>
117+
impl<
118+
'graph,
119+
O: NodeOp + 'graph,
120+
G: GraphViewOps<'graph>,
121+
GH: GraphViewOps<'graph>,
122+
F: NodeFilterOp + Clone + 'graph,
123+
> IntoIterator for LazyNodeState<'graph, O, G, GH, F>
110124
{
111-
type Item = (NodeView<'graph, G>, O::Output);
125+
type Item = (NodeView<'graph, GH>, O::Output);
112126
type IntoIter = BoxedLIter<'graph, Self::Item>;
113127

114128
fn into_iter(self) -> Self::IntoIter {
@@ -120,21 +134,26 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clo
120134
}
121135
}
122136

123-
impl<O, G: IntoDynamic, GH: IntoDynNodeOp + NodeFilterOp + 'static>
124-
LazyNodeState<'static, O, G, GH>
137+
impl<O, G: IntoDynamic, GH: IntoDynamic, F: IntoDynNodeOp + NodeFilterOp + 'static>
138+
LazyNodeState<'static, O, G, GH, F>
125139
{
126-
pub fn into_dyn(self) -> LazyNodeState<'static, O, DynamicGraph, DynNodeFilter> {
140+
pub fn into_dyn(self) -> LazyNodeState<'static, O, DynamicGraph, DynamicGraph, DynNodeFilter> {
127141
LazyNodeState {
128142
nodes: self.nodes.into_dyn(),
129143
op: self.op,
130144
}
131145
}
132146
}
133147

134-
impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clone + 'graph>
135-
LazyNodeState<'graph, O, G, GH>
148+
impl<
149+
'graph,
150+
O: NodeOp + 'graph,
151+
G: GraphViewOps<'graph>,
152+
GH: GraphViewOps<'graph>,
153+
F: NodeFilterOp + Clone + 'graph,
154+
> LazyNodeState<'graph, O, G, GH, F>
136155
{
137-
pub(crate) fn new(op: O, nodes: Nodes<'graph, G, GH>) -> Self {
156+
pub(crate) fn new(op: O, nodes: Nodes<'graph, G, GH, F>) -> Self {
138157
Self { nodes, op }
139158
}
140159

@@ -146,7 +165,7 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clo
146165
self.collect()
147166
}
148167

149-
pub fn compute(&self) -> NodeState<'graph, O::Output, G> {
168+
pub fn compute(&self) -> NodeState<'graph, O::Output, GH> {
150169
if self.nodes.is_filtered() {
151170
let (keys, values): (IndexSet<_, ahash::RandomState>, Vec<_>) = self
152171
.par_iter()
@@ -164,19 +183,25 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + Clo
164183
}
165184
}
166185

167-
impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'graph>
168-
NodeStateOps<'graph> for LazyNodeState<'graph, O, G, GH>
186+
impl<
187+
'graph,
188+
O: NodeOp + 'graph,
189+
G: GraphViewOps<'graph>,
190+
GH: GraphViewOps<'graph>,
191+
F: NodeFilterOp + 'graph,
192+
> NodeStateOps<'graph> for LazyNodeState<'graph, O, G, GH, F>
169193
{
170-
type Select = GH;
194+
type Select = F;
171195
type BaseGraph = G;
196+
type Graph = GH;
172197
type Value<'a>
173198
= O::Output
174199
where
175200
'graph: 'a,
176201
Self: 'a;
177202
type OwnedValue = O::Output;
178203

179-
fn graph(&self) -> &Self::BaseGraph {
204+
fn graph(&self) -> &Self::Graph {
180205
&self.nodes.graph
181206
}
182207

@@ -216,7 +241,7 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'gr
216241

217242
fn iter<'a>(
218243
&'a self,
219-
) -> impl Iterator<Item = (NodeView<'a, &'a Self::BaseGraph>, Self::Value<'a>)> + 'a
244+
) -> impl Iterator<Item = (NodeView<'a, &'a Self::Graph>, Self::Value<'a>)> + 'a
220245
where
221246
'graph: 'a,
222247
{
@@ -226,13 +251,13 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'gr
226251
.map(move |node| (node, self.op.apply(&storage, node.node)))
227252
}
228253

229-
fn nodes(&self) -> Nodes<'graph, Self::BaseGraph, Self::Select> {
254+
fn nodes(&self) -> Nodes<'graph, Self::BaseGraph, Self::Graph, Self::Select> {
230255
self.nodes.clone()
231256
}
232257

233258
fn par_iter<'a>(
234259
&'a self,
235-
) -> impl ParallelIterator<Item = (NodeView<'a, &'a Self::BaseGraph>, Self::Value<'a>)>
260+
) -> impl ParallelIterator<Item = (NodeView<'a, &'a Self::Graph>, Self::Value<'a>)>
236261
where
237262
'graph: 'a,
238263
{
@@ -242,7 +267,7 @@ impl<'graph, O: NodeOp + 'graph, G: GraphViewOps<'graph>, GH: NodeFilterOp + 'gr
242267
.map(move |node| (node, self.op.apply(&storage, node.node)))
243268
}
244269

245-
fn get_by_index(&self, index: usize) -> Option<(NodeView<&Self::BaseGraph>, Self::Value<'_>)> {
270+
fn get_by_index(&self, index: usize) -> Option<(NodeView<&Self::Graph>, Self::Value<'_>)> {
246271
if self.nodes().is_list_filtered() {
247272
self.iter().nth(index)
248273
} else {

raphtory/src/db/api/state/node_state.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,15 @@ impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>> NodeState
303303
for NodeState<'graph, V, G>
304304
{
305305
type BaseGraph = G;
306+
type Graph = G;
306307
type Select = Const<bool>;
307308
type Value<'a>
308309
= &'a V
309310
where
310311
'graph: 'a;
311312
type OwnedValue = V;
312313

313-
fn graph(&self) -> &Self::BaseGraph {
314+
fn graph(&self) -> &Self::Graph {
314315
&self.base_graph
315316
}
316317

@@ -340,7 +341,7 @@ impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>> NodeState
340341

341342
fn iter<'a>(
342343
&'a self,
343-
) -> impl Iterator<Item = (NodeView<'a, &'a Self::BaseGraph>, Self::Value<'a>)> + 'a
344+
) -> impl Iterator<Item = (NodeView<'a, &'a Self::Graph>, Self::Value<'a>)> + 'a
344345
where
345346
'graph: 'a,
346347
{
@@ -359,15 +360,20 @@ impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>> NodeState
359360
}
360361
}
361362

362-
fn nodes(&self) -> Nodes<'graph, Self::BaseGraph, Self::Select> {
363-
Nodes::new_filtered(self.base_graph.clone(), Const(true), self.keys.clone())
363+
fn nodes(&self) -> Nodes<'graph, Self::BaseGraph, Self::Graph, Self::Select> {
364+
Nodes::new_filtered(
365+
self.base_graph.clone(),
366+
self.base_graph.clone(),
367+
Const(true),
368+
self.keys.clone(),
369+
)
364370
}
365371

366372
fn par_iter<'a>(
367373
&'a self,
368374
) -> impl ParallelIterator<
369375
Item = (
370-
NodeView<'a, &'a <Self as NodeStateOps<'graph>>::BaseGraph>,
376+
NodeView<'a, &'a <Self as NodeStateOps<'graph>>::Graph>,
371377
<Self as NodeStateOps<'graph>>::Value<'a>,
372378
),
373379
>
@@ -390,7 +396,7 @@ impl<'graph, V: Clone + Send + Sync + 'graph, G: GraphViewOps<'graph>> NodeState
390396
}
391397
}
392398

393-
fn get_by_index(&self, index: usize) -> Option<(NodeView<&Self::BaseGraph>, Self::Value<'_>)> {
399+
fn get_by_index(&self, index: usize) -> Option<(NodeView<&Self::Graph>, Self::Value<'_>)> {
394400
match &self.keys {
395401
Some(node_index) => node_index.key(index).map(|n| {
396402
(

0 commit comments

Comments
 (0)