Skip to content

feat: edge neighbour sort - #2689

Open
louisch wants to merge 9 commits into
db_v4from
feature/edge-neighbour-sort
Open

feat: edge neighbour sort#2689
louisch wants to merge 9 commits into
db_v4from
feature/edge-neighbour-sort

Conversation

@louisch

@louisch louisch commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • raphtory-graphql API for sorting edges by properties on the nodes (neighbours) they connect to.
  • Adding type and name sorting to NodeSortBy in raphtory-graphql

Why are the changes needed?

In the UI I'd like to be able to do a sort of exploded edges by the neighbours that they connect to, then page. The only thing missing was a way for the edge sort to be able to sort by the neighbours that they connect to.

Does this PR introduce any user-facing change? If yes is this documented?

Yes, it's new API endpoints. Docs added above each endpoint function.

How was this patch tested?

Tests added for type sorting, and sorting edges by their neighbours

Are there any further changes required?

No

@louisch louisch changed the title Edge neighbour sort feat: edge neighbour sort Jul 23, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 03d30e3 Previous: 9823ef7 Ratio
lotr_graph/num_edges 4 ns/iter (± 0) 0 ns/iter (± 0) +∞
lotr_graph/num_nodes 6 ns/iter (± 0) 1 ns/iter (± 0) 6
lotr_graph/graph_latest 3 ns/iter (± 0) 0 ns/iter (± 0) +∞
lotr_graph_materialise/materialize 7838110 ns/iter (± 74379) 1564816 ns/iter (± 35303) 5.01
lotr_graph_window_100/num_nodes 15 ns/iter (± 0) 5 ns/iter (± 0) 3
lotr_graph_window_100_materialise/materialize 8171452 ns/iter (± 61417) 1669150 ns/iter (± 10700) 4.90
lotr_graph_window_10/has_node_existing 134 ns/iter (± 9) 62 ns/iter (± 11) 2.16
lotr_graph_window_10_materialise/materialize 3423478 ns/iter (± 20068) 971980 ns/iter (± 4278) 3.52
lotr_graph_subgraph_10pc_materialise/materialize 2068832 ns/iter (± 15680) 334634 ns/iter (± 1287) 6.18
lotr_graph_subgraph_10pc_windowed/has_node_existing 139 ns/iter (± 11) 62 ns/iter (± 14) 2.24
lotr_graph_subgraph_10pc_windowed_materialise/materialize 1259051 ns/iter (± 13585) 230399 ns/iter (± 2617) 5.46
lotr_graph_window_50_layered/num_edges_temporal 143109 ns/iter (± 2688) 70121 ns/iter (± 7586) 2.04
lotr_graph_window_50_layered/has_node_existing 374 ns/iter (± 23) 129 ns/iter (± 12) 2.90
lotr_graph_window_50_layered/graph_latest 82969 ns/iter (± 1601) 36649 ns/iter (± 916) 2.26
lotr_graph_window_50_layered_materialise/materialize 28911871 ns/iter (± 103956) 3488825 ns/iter (± 24948) 8.29
lotr_graph_persistent_window_50_layered/num_edges_temporal 583790 ns/iter (± 12810) 192686 ns/iter (± 1569) 3.03
lotr_graph_persistent_window_50_layered/has_node_existing 413 ns/iter (± 352) 174 ns/iter (± 83) 2.37
lotr_graph_persistent_window_50_layered/graph_latest 130282 ns/iter (± 7260) 57549 ns/iter (± 4809) 2.26
lotr_graph_persistent_window_50_layered_materialise/materialize 50254683 ns/iter (± 979480) 5298035 ns/iter (± 147912) 9.49

This comment was automatically generated by workflow using github-action-benchmark.

@ljeub-pometry
ljeub-pometry self-requested a review July 31, 2026 08:19

@ljeub-pometry ljeub-pometry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The src and dst options for edge sorting should also take a NodeSortBy (especially useful for graph-level edges)

Comment thread raphtory-graphql/src/model/sorting.rs Outdated
Comment on lines +10 to +13
pub src: Option<bool>,
/// Destination
pub dst: Option<bool>,
/// Sort by the neighbour node (the endpoint that is NOT the node these

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these also take a NodeSortBy? Otherwise, you can't sort a graph-level edge collection by src...

louisch and others added 3 commits August 1, 2026 11:09
Keep the identity-related keys (id, name) adjacent, ahead of type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses review feedback: src/dst previously accepted only a bool (sort by
node id). Making them Option<NodeSortBy> lets graph-level edge collections
sort by the src/dst node's type/name/property, and unifies all three node
keys (src/dst/neighbour) through compare_node. Breaking schema change:
{ src: true } becomes { src: { id: true } }.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants