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

Add in and out edge indices functions #1369

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ThisuraGallage
Copy link

@ThisuraGallage ThisuraGallage commented Jan 21, 2025

This PR introduces a new method, in_edge_indices, to the rustworkx.PyDiGraph class. The method returns the indices of incoming edges for a specified node.
#1360

  • I ran rustfmt locally
  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

I'll add the documentation once the function signature is finalized.

@ThisuraGallage ThisuraGallage changed the title Add in edge indices function [WIP]Add in edge indices function Jan 21, 2025
@coveralls
Copy link

coveralls commented Jan 23, 2025

Pull Request Test Coverage Report for Build 12926634311

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 40 of 40 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.009%) to 95.82%

Totals Coverage Status
Change from base Build 12817417491: 0.009%
Covered Lines: 18383
Relevant Lines: 19185

💛 - Coveralls

Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

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

The current implementation looks good to me. I left some minor nitpick comments but they are not blocking.

What is going to be more work is adding even more methods...

  • PyGraph should have the same methods even if the implementation is just calling incident_edges for consistency
  • PyDiGraph and PyGraph could use a out_edge_indices

So that is 3 more methods which were in the original request but are useful to maintain some coherence accross the API

rustworkx/rustworkx.pyi Show resolved Hide resolved
src/digraph.rs Outdated Show resolved Hide resolved
src/digraph.rs Show resolved Hide resolved
src/digraph.rs Show resolved Hide resolved
tests/digraph/test_edges.py Show resolved Hide resolved
tests/digraph/test_edges.py Outdated Show resolved Hide resolved
@IvanIsCoding IvanIsCoding added this to the 0.17.0 milestone Jan 23, 2025
@ThisuraGallage ThisuraGallage marked this pull request as ready for review January 23, 2025 11:02
@ThisuraGallage ThisuraGallage changed the title [WIP]Add in edge indices function Add in and out edge indices functions Jan 23, 2025
Copy link
Collaborator

@IvanIsCoding IvanIsCoding left a comment

Choose a reason for hiding this comment

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

LGTM but I will run this through @mtreinish before adding four similar methods for a second opinion

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