Skip to content

Conversation

@mschimek
Copy link
Member

@mschimek mschimek commented Nov 5, 2025

No description provided.

@mschimek mschimek force-pushed the feature/edge-range branch 2 times, most recently from 2357b28 to 8723531 Compare November 5, 2025 22:06
@mschimek mschimek requested a review from niklas-uhl November 6, 2025 06:46
@niklas-uhl niklas-uhl requested a review from Copilot November 6, 2025 07:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new EdgeRange class that provides unified iteration over graph edges regardless of their internal representation (edge list or CSR). The implementation includes both the core functionality and comprehensive test coverage.

Key changes:

  • Added EdgeRange class supporting iteration over both edge list and CSR graph representations
  • Implemented forward iterator pattern with proper operator overloading
  • Created comprehensive test suite covering both sparse and dense graphs in both representations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
kagen/edge_range.h Declares the EdgeRange class and its iterator interface for unified edge iteration
kagen/edge_range.cpp Implements iteration logic for both edge list and CSR representations
tests/edge_range.cpp Tests edge iteration across multiple graph types and representations
tests/CMakeLists.txt Adds test configuration for the new edge range test suite

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


explicit EdgeRange(const Edgelist& edgelist) noexcept;
EdgeRange(const XadjArray& xadj, const AdjncyArray& adjncy, VertexRange vertex_range) noexcept;
EdgeRange(const Graph& graph)noexcept;
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Missing space between closing parenthesis and noexcept keyword. Should be EdgeRange(const Graph& graph) noexcept; for consistency with other declarations in the file.

Suggested change
EdgeRange(const Graph& graph)noexcept;
EdgeRange(const Graph& graph) noexcept;

Copilot uses AI. Check for mistakes.
Comment on lines 14 to 38
void check_edge_range(const Graph& graph) {
Edgelist edgelist = graph.edges;
if (graph.representation == GraphRepresentation::CSR) {
edgelist = BuildEdgeListFromCSR(graph.vertex_range, graph.xadj, graph.adjncy);
}
EdgeRange edge_range(graph);

{
std::size_t expected_index = 0;
for (auto it = edge_range.begin(); it != edge_range.end(); ++it) {
auto edge = *it;
EXPECT_EQ(it.edge_index(), expected_index);
EXPECT_EQ(*it, edge);
++expected_index;
}
}

{
EXPECT_EQ(edge_range.size(), edgelist.size());
for (std::size_t i = 0; auto elem: edge_range) {
EXPECT_EQ(elem, edgelist[i]);
++i;
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider putting this directly in the assertion via matchers, this makes the test output more readable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot can you show an example?

Copy link
Contributor

Copilot AI commented Nov 6, 2025

@niklas-uhl I've opened a new pull request, #76, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 6, 2025

@niklas-uhl I've opened a new pull request, #77, to work on those changes. Once the pull request is ready, I'll request review from you.

mschimek and others added 4 commits November 6, 2025 08:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…d tests (#76)

* Initial plan

* Refactor edge_range test to use GoogleTest matchers

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Use matchers for edge index verification as well

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Remove check_edge_range helper and inline logic into tests

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Remove unnecessary CSR check from edgelist tests

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Convert tests to parameterized tests by generator type and remove always-true conditionals

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Use custom matcher for edge index check without allocating vector

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Revert custom matcher, use explicit loop for edge index check

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

* Use Pointwise matcher with EdgeIndexMatches for edge index verification

Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: niklas-uhl <23433189+niklas-uhl@users.noreply.github.com>
Co-authored-by: Tim Niklas Uhl <uhl@kit.edu>
@mschimek mschimek merged commit de8d155 into main Nov 6, 2025
4 checks passed
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.

3 participants