Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR involves refactoring the
backtracking_search
interface, which now acceptstake
,max
, andfilter
keyword arguments.take
= number of homomorphisms requested (stop the search process early if this number is reached)max
= throw an error if we find more than this many morphisms (e.g. setmax=1
if one expects 0 or 1 morphism)filter
= only consider morphisms which meet some criteria, expressed as a Julia function of typeACSetTransformation -> Bool
This allows
homomorphism
to be redefined as:The old behavior is recovered via
any=true
, but this should not be default as it leads to endless user confusion. Thus there is a version bump for this breaking change.The postprocessing logic for solutions to backtracking search (introduced recently in #918) was simplified and moved into its own function to not clutter
backtracking_search
.Note:
filter
is needed for certain AlgebraicRewriting features, such as trying to get a single (but arbitrary) homomorphism subject to certain arbitrary constraints, such as the dangling condition, NACs, etc.Also note: there was an unrelated bug in
coerce_component
for MarkAsDeleted ACSets which was unearthed in this process.