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 is_subgraph_isomorphic function #317

Merged
merged 13 commits into from
May 28, 2021
Merged

Conversation

georgios-ts
Copy link
Collaborator

Adds a function to determine if two graphs are induced subgraph isomorphic.
This new feature is simple to implement since it's the same code with is_isomorphic function except in feasibility rules we check >= relation instead of ==.

@coveralls
Copy link

coveralls commented May 8, 2021

Pull Request Test Coverage Report for Build 886373020

  • 111 of 111 (100.0%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.2%) to 96.799%

Files with Coverage Reduction New Missed Lines %
src/iterators.rs 1 92.32%
src/lib.rs 1 99.33%
src/isomorphism.rs 4 97.44%
Totals Coverage Status
Change from base Build 885754244: 0.2%
Covered Lines: 8438
Relevant Lines: 8717

💛 - Coveralls

src/isomorphism.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@mtreinish mtreinish added this to the 0.9.0 milestone May 18, 2021
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.

This is great, is_subgraph_isomorphic reuses almost all is_isomorphic code which in my opinion is an indicator of good design!

Just a minor debate: should we use a macro and pass $op, or should we go with a more standard approach and use an Ordering argument?

I am biased towards passing an argument, it feels closer to how we write our Python code.

src/isomorphism.rs Outdated Show resolved Hide resolved
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This lgtm, just some issues with the docstring for the universal function and the default for id_order python is different from the rust functions we probably want it to be consistent.

retworkx/__init__.py Outdated Show resolved Hide resolved
retworkx/__init__.py Outdated Show resolved Hide resolved
retworkx/__init__.py Outdated Show resolved Hide resolved
retworkx/__init__.py Outdated Show resolved Hide resolved
retworkx/__init__.py Outdated Show resolved Hide resolved
retworkx/__init__.py Outdated Show resolved Hide resolved
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. The diff is larger using Ordering, but ultimately I believe it will be easier to maintain.

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.

None yet

4 participants