Deterministic pattern matcher for WolframModel.
Exposes a general match/2 that handles rules with any number of pattern
hyperedges (1, 2, or N) via recursive backtracking. Patterns are matched
positionally: the element at position i in the pattern binds to the element
at position i in the matched hyperedge. Shared variables across patterns must
map to the same vertex in every matched hyperedge.
Hyperedges are ordered lists. Each pattern variable can be any term; atoms and integers are treated as variable names to bind.
Summary
Functions
Builds a merged mapping from two (pattern, hyperedge) pairs. Kept for backward compatibility.
Finds all ways to match patterns against hyperedges with consistent
variable bindings. Supports patterns of any length (1, 2, or N hyperedges).
Types
@type match_result() :: %{ mapping: map(), matched_hyperedges: [Hypergraph.hyperedge()] }
Functions
Builds a merged mapping from two (pattern, hyperedge) pairs. Kept for backward compatibility.
@spec match([Hypergraph.hyperedge()], [Hypergraph.hyperedge()]) :: [match_result()]
Finds all ways to match patterns against hyperedges with consistent
variable bindings. Supports patterns of any length (1, 2, or N hyperedges).
Returns a list of %{mapping: map(), matched_hyperedges: [hyperedge()]}.
Each matched_hyperedges list has the same length as patterns and is in the
same order. Each distinct hyperedge in the graph may only be used once per
match (no self-overlap).