Add self-referential nodes to egraph #240
Answered
by
mwillsey
silversquirl
asked this question in
Q&A
-
Is it possible to add an ENode that references itself? Or, more generally, to add a cycle to the EGraph? |
Beta Was this translation helpful? Give feedback.
Answered by
mwillsey
Feb 28, 2023
Replies: 1 comment
-
Yes! You cannot directly make a cycle, but you can do it with a union. Here is some (un-parsed) code to demonstrate: let x = egraph.add(Leaf("x"));
let node = egraph.add(Node(x, x));
egraph.union(x, node); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
silversquirl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes! You cannot directly make a cycle, but you can do it with a union. Here is some (un-parsed) code to demonstrate: