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

Constrain acset hom search to specified subsets #873

Merged
merged 2 commits into from Jan 19, 2024

Conversation

kris-brown
Copy link
Contributor

@kris-brown kris-brown commented Dec 11, 2023

This constraint allows one to say, e.g. when searching for maps from the path graph with two edges into some big graph, that V2 must be sent to either vertex 2, 5, or 6 in the codomain, and that E1 must be sent to edge 3 or 7 in the codomain, etc. I.e. we have the option to restrict valid assignments to an arbitrary subset of the codomain for each part in the domain.

This is a required feature for my implementation of incremental hom search.

This is technically a generalization of the initial keyword argument, which would be valid assigning a singleton set to some part of the domain. However, the way that case is treated (immediately beginning hom search with that assignment) is very different from the general case (a check when making an assignment arbitrarily deep in the tree), so it's helpful to be able to declare these separately.

@AlgebraicJulia AlgebraicJulia deleted a comment from github-actions bot Jan 17, 2024
@epatters epatters changed the title valid constraint for homsearch Constrain acset hom search to specified subsets Jan 17, 2024
Copy link
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

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

Thanks Kris! Since in the end the implementation just adds an extra predicate to check, it might be cleaner and slightly more flexible to call the keyword argument predicates and have it take a dict of dicts of arbitrary predicates (boolean-valued Julia functions). Then to recover the current behavior, you pass the lambda x -> x ∈ my_set. What do you think?

@kris-brown
Copy link
Contributor Author

Yeah I like this idea a lot!

@kris-brown
Copy link
Contributor Author

Hm on second thought, can we think of any properties other than the simple subset relation that make sense? It seems like you'll always be able to determine the relevant subset before you run the hom search. There's no useful data at runtime (even if you were to throw the current BacktrackingState into the predicate, you have no idea what order the parts are being traversed in) so it's hard to think of a reasonable predicate).

@epatters
Copy link
Member

I agree that in practice this will at most save you a coercion to a set since the input data is finitary, but it might still be nice to not insist on a single data type. Your call.

@kris-brown
Copy link
Contributor Author

It feels nicer whenever we can get away with passing around data rather than functions, and I figured the coercion to Set is a good thing since we enforce O(1) lookup (rather than predicate= i -> i in [1,3,4]). That said I do feel like the word predicate is more clear than valid, even for just giving a subset.

@kris-brown
Copy link
Contributor Author

The Set coercion is allowing the user to pass in any AbstractVector at least, right? Or they could write a Set(::MyStruct) method.

@epatters
Copy link
Member

I'm on board with changing the keyword arg to predicate and keeping the rest the same: it's forward-proof in case requiring a Set is later found to be too constraining.

@epatters epatters merged commit 628c0a8 into AlgebraicJulia:main Jan 19, 2024
10 checks passed
@kris-brown kris-brown deleted the forbidden_hom branch February 15, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants