graph
graph copied to clipboard
Add user callback to `vf2_subgraph_mono` to potentially stop search before each check.
Also update documentation and add tests.
See the discussion on #271 .
Remarks:
- I used a simple function pointer for the type rather than a templated "callable" so as to be able to default it, thereby maintaining compatibility with existing code. An alternative would be to define a new method or methods with a different name; this seems a bit like overkill but I can do that if preferred.
- I only changed
vf2_subgraph_mono
, notvf2_subgraph_iso
, but it should be simple to do the same thing there too if desired. - The tests are pretty basic. It isn't obvious to me how to test this fully without knowing internal details of the order of search. Suggestions welcome.
Looks great so far! Thanks for keeping it simple, sorry it took me so long to take a look. I just made a couple of requests for changes.
Thank you for the review Jeremy! I have actually switched to a different solution now, so no longer need this. I may come back to it anyway if you or others think it generally useful, though I cannot prioritize it just now. So, feel free to close, complete or leave open this PR as you see fit.
By the way, the reason I didn't use a template type for the callback was that I couldn't see how to do so while maintaining backward compatibility (i.e. how to set a no-op default value). I guess an alternative would be to overload the whole function.
OK, no worries. I'll leave this open for a while in case someone else needs the same functionality and wants to finish it off.