egraphs-good / egglog

egraphs + datalog!
https://egraphs-good.github.io/egglog/
MIT License
459 stars 54 forks source link

Potential bug in dot file output #377

Closed hessammehr closed 4 months ago

hessammehr commented 6 months ago

The following works seems to work fine for a small number of data points, i.e. (ion ...)s but larger inputs seem to produce dot files that make no sense (see attached test case).

(datatype Obs
    (Ion f64)
    (Combination Obs Obs))

(rule (
        (= child1 (Ion childmz1))
        (= child2 (Ion childmz2))
        (>= childmz1 childmz2)
        (= lhs (Ion parentmz))
        (= delta (- parentmz (+ childmz1 childmz2)))
        (< delta 0.1) (> delta -0.1))
    (
        (union lhs (Combination child1 child2))
    ))

(let ion_0 (Ion 63.167))
; etc.

Egglog invocation

egglog test.egg --to-dot

Expected behaviour

Each Combination node having two child nodes.

Actual behaviour

Some Combination nodes have one or no child nodes. Not a rendering issue afaik, since the .dot file is also missing the necessary edges.

JSON output seems fine.

test_case.txt

yihozhang commented 6 months ago

Yeah, egglog limits the number of nodes to be rendered: https://github.com/egraphs-good/egglog/blob/main/src/lib.rs#L1539 This prevents the visualization from blowing up, but seems confusing... The interface should probably be more explicit on that (e.g. a question-mark-in-bubble button).

oflatt commented 6 months ago

Related to #368 and problems around the viz. I like the idea of a question mark and a warning

yihozhang commented 4 months ago

I believe this will be fixed by #394