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

ISSUE 87: vf2 algorithm refactor #185

Closed
wants to merge 21 commits into from

Conversation

sracha4355
Copy link

I've restructured the code by splitting up the responsibilities of the algorithm into multiple classes. There are three major components.

  1. Generating candidate vertex pairs based the state of the search space for this algorithm
  2. Updating the sets and mappings that help the algorithm narrow or broaden the search space
  3. Creating a mapping where we map all vertex ids in a graph to the range 1...N where N is the number of vertices in a graph
  4. Checking if a potential candidate vertex pair is a syntactically correct and if that pair has the possibility of leading to a complete isomorphic mapping
    class vf2_target_sets handles 1 and 2
    class vf2_vertex_id_mapper handles 3
    class vf2_isomorphism_feasibility_checker handles 4
    The struct vf2_information holds objects of classes vf2_target_sets and vf2_vertex_id_mapper.
    The main function check_isomorphism uses this struct on its recursive calls and will pass along an object for class vf2_isomorphism_feasibility_checker. The code right now will not pass all the automated checks, but I need to know your thoughts on how I structured my code, the rest is an easy refactor. Thanks @joweich.

@sracha4355 sracha4355 changed the title Vf2 refactor ISSUE 87: vf2 algorithm refactor Jan 3, 2024
Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (b41d141) 99.59% compared to head (2a876bc) 99.43%.
Report is 5 commits behind head on main.

Files Patch % Lines
...rithm/graph_isomorphism/graph_isomorphism_util.tpp 97.84% 6 Missing ⚠️
.../algorithm/graph_isomorphism/graph_isomorphism.tpp 96.55% 1 Missing ⚠️
...gorithm/graph_isomorphism/graph_isomorphism_util.h 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
- Coverage   99.59%   99.43%   -0.16%     
==========================================
  Files          56       60       +4     
  Lines        2738     3390     +652     
==========================================
+ Hits         2727     3371     +644     
- Misses         11       19       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@joweich joweich left a comment

Choose a reason for hiding this comment

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

Hey @sracha4355, very great to see that you built on the feedback from last time (#172 (review))! 🚀
I added a few more comments that are mostly easy fixes. However, I haven't had an in-depth look into the details of graph_isomorphism_utils.tpp. It's still a bit hard to follow what happens in the 500+ lines of code in this file. Given that this algorithm is quite complex, I feel you don't need to optimize/refactor every detail in this PR. Just stop refactoring once you feel you're at a dead end 🙂 We can then do more optimizations in a follow-up PR.
To finally get you your well-deserved contribution to the main branch, I'd suggest to have a look into my latest feedback, add some more tests for minimal and more complex cases, and remove the debugging statements and commented-out code.
At some point, we'll also need a documentation page for the VF2 algorithm, but this can be done in a follow-up PR as well 🙂

test/graaflib/algorithm/graph_isomorphism.cpp Outdated Show resolved Hide resolved
test/graaflib/algorithm/graph_isomorphism.cpp Outdated Show resolved Hide resolved
test/graaflib/algorithm/graph_isomorphism.cpp Outdated Show resolved Hide resolved
test/graaflib/algorithm/graph_isomorphism.cpp Outdated Show resolved Hide resolved
include/graaflib/algorithm/graph_isomorphism_util.h Outdated Show resolved Hide resolved
include/graaflib/algorithm/graph_isomorphism.tpp Outdated Show resolved Hide resolved
include/graaflib/algorithm/graph_isomorphism_util.tpp Outdated Show resolved Hide resolved
include/graaflib/algorithm/graph_isomorphism_util.tpp Outdated Show resolved Hide resolved
include/graaflib/algorithm/graph_isomorphism_util.tpp Outdated Show resolved Hide resolved
include/graaflib/algorithm/graph_isomorphism.h Outdated Show resolved Hide resolved
Copy link
Contributor

Marking this PR as stale. It will not be automatically closed.

Even though the maintainers of Graaf may not always have time to take a look in a timely fashion, your contributions are much appreciated.
Please allow some time for @bobluppes to take a closer look.

@github-actions github-actions bot added the stale label Feb 19, 2024
@bobluppes
Copy link
Owner

Hi @sracha4355, sorry for the late reply and thanks a lot for working on this.

The implementation of the VF2 algorithm is definitely a lot more complex than I initially thought 😅 Nonetheless, very nice to see that you managed to implement this from scratch! Before merging this though, I would like to gain some more confidence in the correctness of the implementation by enhancing the unit tests.

Going forward, I would propose to close the current PR and to keep the branch as a reference implementation. Please feel free to ping me / re-open though if you would like to continue on this.

@bobluppes bobluppes closed this Jun 26, 2024
@sracha4355
Copy link
Author

@bobluppes yeah the algorithm is definitely a beast of its own. I will let you know if I am available to work on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants