zxcalc / quantomatic

Quantomatic is a tool for doing automated graph rewriting.
http://quantomatic.github.io
152 stars 22 forks source link

simproc API : rewrite targeted w metric #190

Open rossduncan opened 6 years ago

rossduncan commented 6 years ago

Add a new simproc combinator:

REWRITE_TARGETED_W_METRIC(rule, v, f, m) takes a rule, the name of a vertex 'v' within the rule (as a string), a targeting function 'f' from graphs to a vertex name, and a metric function m. It will apply the rule on a graph 'g' by first attempting to match 'v' on 'f(g)', then matching the rest, only if the resulting graph reduces the metric.

(and ditto for weak metrics)