Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added small fix to stop edges returning self loops twice #1485

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/tests/test_graphdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_windowed_graph_edges():
for e in e_iter:
edges.append([e.src.id, e.dst.id])

assert edges == [[1, 1], [1, 1], [1, 2], [1, 3], [1, 2], [3, 2], [1, 3], [3, 2]]
assert edges == [[1, 1], [1, 2], [1, 3], [1, 2], [3, 2], [1, 3], [3, 2]]

tedges = [v.in_edges for v in view.nodes]
in_edges = []
Expand Down
2 changes: 1 addition & 1 deletion raphtory/src/db/graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::{
core::{entities::graph::tgraph::InnerTemporalGraph, utils::errors::GraphError},
db::api::{
mutation::internal::{InheritAdditionOps, InheritMutationOps, InheritPropertyAdditionOps},

Check warning on line 22 in raphtory/src/db/graph/graph.rs

View workflow job for this annotation

GitHub Actions / Run benchmarks / Rust Benchmark (ubuntu-latest)

unused imports: `InheritAdditionOps`, `InheritPropertyAdditionOps`

Check warning on line 22 in raphtory/src/db/graph/graph.rs

View workflow job for this annotation

GitHub Actions / Run Python tests / Python Tests (3.8, macos-latest)

unused imports: `InheritAdditionOps`, `InheritPropertyAdditionOps`

Check warning on line 22 in raphtory/src/db/graph/graph.rs

View workflow job for this annotation

GitHub Actions / Run Python tests / Python Tests (3.8, ubuntu-latest)

unused imports: `InheritAdditionOps`, `InheritPropertyAdditionOps`

Check warning on line 22 in raphtory/src/db/graph/graph.rs

View workflow job for this annotation

GitHub Actions / Run Python tests / Python Tests (3.8, windows-latest)

unused imports: `InheritAdditionOps`, `InheritPropertyAdditionOps`
view::internal::{Base, InheritViewOps, MaterializedGraph, Static},
},
prelude::*,
Expand Down Expand Up @@ -560,7 +560,7 @@
g.add_edge(*t, *src, *dst, NO_PROPS, None).unwrap();
}

let expected = vec![(2, 3, 2), (1, 0, 0), (1, 0, 0)];
let expected = vec![(2, 3, 1), (1, 0, 0), (1, 0, 0)];
let actual = (1..=3)
.map(|i| {
let v = g.node(i).unwrap();
Expand Down
1 change: 1 addition & 0 deletions raphtory/src/db/internal/graph_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ impl<'graph, const N: usize> GraphOps<'graph> for InnerTemporalGraph<N> {
}
Direction::BOTH => Box::new(
self.node_edges(v, Direction::IN, layers.clone(), filter)
.filter(|e| e.src() != e.dst())
.merge(self.node_edges(v, Direction::OUT, layers, filter)),
),
}
Expand Down
Loading