Test if (open)hypergraphs are acyclic#24
Merged
statusfailed merged 16 commits intohellas-ai:masterfrom Feb 18, 2026
Merged
Conversation
statusfailed
requested changes
Feb 12, 2026
Contributor
statusfailed
left a comment
There was a problem hiding this comment.
only one minor change - operation_adjacency breaks public API. Please keep this one the same & add another function taking a Hypergraph argument if needed
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
For rewrites in SMC we need acycle hypergraphs.
Details
is_acyclicon Hypergraph and OpenHypergraph. We define the condition on strict because cycles can be the result of quotiening, if the graph is not strict, we might wrongly assume that it is acyclic.node_adjacencysimilar tooperation_adjacencywhere adjacency isIndexedCoproduct<K, FiniteFunction<K>>, intuitively a map nodes -> list of next nodes. We run kahn onnode_adjacencyfor testing for cycles: Kahn’s algorithm removes all nodes if and only if the directed graph is acyclic (it runs on each connected components). Initial implementation used DFS, but better to reuse existing logic.Known Issues and Tradeoffs
At the moment we don't cache or optimize memory, but it is something we might consider in the future.
is_acyclicrebuilds node level adjacency each call; repeated checks will pay this cost repeatedly. We could cache adjacency.