Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianmurariu committed May 24, 2024
1 parent 3152378 commit 097e8e8
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 84 deletions.
10 changes: 1 addition & 9 deletions raphtory/src/algorithms/components/scc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ fn tarjan<'graph, G>(

for neighbor in node.out_neighbours() {
if !indices.contains_key(&neighbor.node) {
tarjan(
neighbor,
index,
stack,
indices,
lowlink,
on_stack,
result,
);
tarjan(neighbor, index, stack, indices, lowlink, on_stack, result);
lowlink.insert(node.node, lowlink[&node.node].min(lowlink[&neighbor.node]));
} else if on_stack.contains(&neighbor.node) {
lowlink.insert(node.node, lowlink[&node.node].min(indices[&neighbor.node]));
Expand Down
4 changes: 1 addition & 3 deletions raphtory/src/arrow/graph_impl/core_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ impl CoreGraphOps for ArrowGraph {
match v {
NodeRef::Internal(vid) => Some(vid),
NodeRef::External(vid) => self.inner.find_node(&GID::U64(vid)),
NodeRef::ExternalStr(string) => self
.inner
.find_node(&GID::Str(string.into())),
NodeRef::ExternalStr(string) => self.inner.find_node(&GID::Str(string.into())),
}
}

Expand Down
20 changes: 3 additions & 17 deletions raphtory/src/arrow/graph_impl/edge_storage_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,11 @@ use std::{iter, ops::Range};

impl<'a> EdgeStorageOps<'a> for Edge<'a> {
fn in_ref(self) -> EdgeRef {
EdgeRef::new_incoming(
self.eid(),
self.src_id(),
self.dst_id(),
)
.at_layer(self.layer_id())
EdgeRef::new_incoming(self.eid(), self.src_id(), self.dst_id()).at_layer(self.layer_id())
}

fn out_ref(self) -> EdgeRef {
EdgeRef::new_outgoing(
self.eid(),
self.src_id(),
self.dst_id(),
)
.at_layer(self.layer_id())
EdgeRef::new_outgoing(self.eid(), self.src_id(), self.dst_id()).at_layer(self.layer_id())
}

fn active(self, layer_ids: &LayerIds, w: Range<i64>) -> bool {
Expand Down Expand Up @@ -97,11 +87,7 @@ impl<'a> EdgeStorageOps<'a> for Edge<'a> {
layer_ids.contains(&self.layer_id()) && self.has_temporal_prop_inner(prop_id)
}

fn temporal_prop_layer(
self,
layer_id: usize,
prop_id: usize,
) -> impl TPropOps<'a> + Sync + 'a {
fn temporal_prop_layer(self, layer_id: usize, prop_id: usize) -> impl TPropOps<'a> + Sync + 'a {
if layer_id == self.layer_id() {
self.temporal_property_field(prop_id)
.and_then(|field| read_tprop_column(prop_id, field, self))
Expand Down
10 changes: 2 additions & 8 deletions raphtory/src/arrow/graph_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,8 @@ impl ArrowGraph {
dst_col,
time_col,
}| {
ExternalEdgeList::new(
layer,
parquet_dir.as_ref(),
src_col,
dst_col,
time_col,
)
.expect("Failed to load events")
ExternalEdgeList::new(layer, parquet_dir.as_ref(), src_col, dst_col, time_col)
.expect("Failed to load events")
},
)
.collect::<Vec<_>>();
Expand Down
1 change: 0 additions & 1 deletion raphtory/src/arrow/graph_impl/prop_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,5 @@ pub fn schema_from_prop_meta(prop_map: &PropMapper) -> Schema {
}
}


Schema::from(schema)
}
9 changes: 3 additions & 6 deletions raphtory/src/arrow/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ mod test {

let graph = ArrowGraph::from_graph(&g, graph_dir.path()).unwrap();

let result =
rayon2::execute::<VecState>(query, NodeSource::All, &graph, VecState::new);
let result = rayon2::execute::<VecState>(query, NodeSource::All, &graph, VecState::new);
assert!(result.is_ok());
let mut actual = receiver.into_iter().map(|(state, _)| state.0).collect_vec();
actual.sort();
Expand Down Expand Up @@ -206,8 +205,7 @@ mod test {

let graph = ArrowGraph::from_graph(&g, graph_dir.path()).unwrap();

let result =
rayon2::execute::<VecState>(query, NodeSource::All, &graph, VecState::new);
let result = rayon2::execute::<VecState>(query, NodeSource::All, &graph, VecState::new);
assert!(result.is_ok());
let (path, vid) = receiver.recv().unwrap();
assert_eq!(vid, VID(2));
Expand All @@ -232,8 +230,7 @@ mod test {

let graph = ArrowGraph::from_graph(&g, graph_dir.path()).unwrap();

let result =
rayon2::execute::<VecState>(query, NodeSource::All, &graph, VecState::new);
let result = rayon2::execute::<VecState>(query, NodeSource::All, &graph, VecState::new);
assert!(result.is_ok());

let mut results = receiver.into_iter().collect::<Vec<_>>();
Expand Down
23 changes: 7 additions & 16 deletions raphtory/src/arrow/storage_interface/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ impl<'a> ArrowNode<'a> {
.nodes_storage()
.out_adj_list(self.vid)
.map(move |(eid, dst)| {
EdgeRef::new_outgoing(eid, self.vid, dst)
.at_layer(layer_id)
EdgeRef::new_outgoing(eid, self.vid, dst).at_layer(layer_id)
})
})
.kmerge_by(|e1, e2| e1.remote() <= e2.remote()),
Expand All @@ -59,8 +58,7 @@ impl<'a> ArrowNode<'a> {
.nodes_storage()
.out_adj_list(self.vid)
.map(move |(eid, dst)| {
EdgeRef::new_outgoing(eid, self.vid, dst)
.at_layer(*layer_id)
EdgeRef::new_outgoing(eid, self.vid, dst).at_layer(*layer_id)
}),
),
LayerIds::Multiple(ids) => LayerVariants::Multiple(
Expand All @@ -70,8 +68,7 @@ impl<'a> ArrowNode<'a> {
.nodes_storage()
.out_adj_list(self.vid)
.map(move |(eid, dst)| {
EdgeRef::new_outgoing(eid, self.vid, dst)
.at_layer(layer_id)
EdgeRef::new_outgoing(eid, self.vid, dst).at_layer(layer_id)
})
})
.kmerge_by(|e1, e2| e1.remote() <= e2.remote()),
Expand All @@ -91,8 +88,7 @@ impl<'a> ArrowNode<'a> {
.nodes_storage()
.in_adj_list(self.vid)
.map(move |(eid, src)| {
EdgeRef::new_incoming(eid, src, self.vid)
.at_layer(layer_id)
EdgeRef::new_incoming(eid, src, self.vid).at_layer(layer_id)
})
})
.kmerge_by(|e1, e2| e1.remote() <= e2.remote()),
Expand All @@ -102,8 +98,7 @@ impl<'a> ArrowNode<'a> {
.nodes_storage()
.in_adj_list(self.vid)
.map(move |(eid, src)| {
EdgeRef::new_incoming(eid, src, self.vid)
.at_layer(*layer_id)
EdgeRef::new_incoming(eid, src, self.vid).at_layer(*layer_id)
}),
),
LayerIds::Multiple(ids) => LayerVariants::Multiple(
Expand All @@ -113,8 +108,7 @@ impl<'a> ArrowNode<'a> {
.nodes_storage()
.in_adj_list(self.vid)
.map(move |(eid, src)| {
EdgeRef::new_incoming(eid, src, self.vid)
.at_layer(layer_id)
EdgeRef::new_incoming(eid, src, self.vid).at_layer(layer_id)
})
})
.kmerge_by(|e1, e2| e1.remote() <= e2.remote()),
Expand Down Expand Up @@ -279,10 +273,7 @@ impl<'a> NodeStorageOps<'a> for ArrowNode<'a> {
let eid = self.layers[layer]
.nodes_storage()
.find_edge(self.vid, dst)?;
Some(
EdgeRef::new_outgoing(eid, self.vid, dst)
.at_layer(layer),
)
Some(EdgeRef::new_outgoing(eid, self.vid, dst).at_layer(layer))
}
_ => todo!("multtilayer edge views not implemented in arrow yet"),
},
Expand Down
4 changes: 1 addition & 3 deletions raphtory/src/db/api/mutation/property_addition_ops.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::{
core::{
utils::{errors::GraphError, time::TryIntoTime},
},
core::utils::{errors::GraphError, time::TryIntoTime},
db::api::mutation::{
internal::{InternalAdditionOps, InternalPropertyAdditionOps},
TryIntoInputTime,
Expand Down
6 changes: 1 addition & 5 deletions raphtory/src/db/api/storage/edges/edge_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,7 @@ impl<'a, 'b: 'a> EdgeStorageOps<'a> for &'a EdgeStorageEntry<'b> {
self.as_ref().has_temporal_prop(layer_ids, prop_id)
}

fn temporal_prop_layer(
self,
layer_id: usize,
prop_id: usize,
) -> impl TPropOps<'a> + Sync + 'a {
fn temporal_prop_layer(self, layer_id: usize, prop_id: usize) -> impl TPropOps<'a> + Sync + 'a {
self.as_ref().temporal_prop_layer(layer_id, prop_id)
}

Expand Down
6 changes: 1 addition & 5 deletions raphtory/src/db/api/storage/edges/edge_owned_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ impl<'a> EdgeStorageOps<'a> for &'a EdgeOwnedEntry {
self.as_ref().has_temporal_prop(layer_ids, prop_id)
}

fn temporal_prop_layer(
self,
layer_id: usize,
prop_id: usize,
) -> impl TPropOps<'a> + Sync + 'a {
fn temporal_prop_layer(self, layer_id: usize, prop_id: usize) -> impl TPropOps<'a> + Sync + 'a {
self.as_ref().temporal_prop_layer(layer_id, prop_id)
}

Expand Down
6 changes: 1 addition & 5 deletions raphtory/src/db/api/storage/edges/edge_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ impl<'a> EdgeStorageOps<'a> for EdgeStorageRef<'a> {
for_all!(self, edge => EdgeStorageOps::has_temporal_prop(edge, layer_ids, prop_id))
}

fn temporal_prop_layer(
self,
layer_id: usize,
prop_id: usize,
) -> impl TPropOps<'a> + Sync + 'a {
fn temporal_prop_layer(self, layer_id: usize, prop_id: usize) -> impl TPropOps<'a> + Sync + 'a {
for_all_iter!(self, edge => edge.temporal_prop_layer(layer_id, prop_id))
}
}
6 changes: 1 addition & 5 deletions raphtory/src/db/api/storage/edges/edge_storage_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ pub trait EdgeStorageOps<'a>: Copy + Sized + Send + Sync + 'a {
.any(move |id| !self.temporal_prop_layer(id, prop_id).is_empty())
}

fn temporal_prop_layer(
self,
layer_id: usize,
prop_id: usize,
) -> impl TPropOps<'a> + Sync + 'a;
fn temporal_prop_layer(self, layer_id: usize, prop_id: usize) -> impl TPropOps<'a> + Sync + 'a;

fn temporal_prop_iter(
self,
Expand Down
2 changes: 1 addition & 1 deletion raphtory/src/db/graph/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use chrono::{DateTime, Utc};
use crate::{
core::{
entities::{edges::edge_ref::EdgeRef, LayerIds, VID},
storage::timeindex::{AsTime},
storage::timeindex::AsTime,
utils::{errors::GraphError, time::IntoTime},
ArcStr,
},
Expand Down

0 comments on commit 097e8e8

Please sign in to comment.