heuermh / lick

LiCK, Library for ChucK
GNU General Public License v3.0
147 stars 21 forks source link

`visited` field for Node; cycle detection in Graphs.randomWalk() #51

Closed gewang closed 1 year ago

gewang commented 1 year ago

Not sure if this is in the convention of LiCK, or if the proposed changes are entirely correct 😆 Since 1.5.1.1 we have add LiCK to our extended test set for chuck development. We noticed that running chuck import.ck tests.ck sometimes hangs on GraphsTest.ck. Further investigation suggests that the hanging seems to happen in Graphs.randomWalk() and may be the result of cycles in the graph (apropos of an existing TODO comment in the function). Hence we have these proposed additions to Node and Graphs.randomWalk(). Again, while these additions do seem to avoid hang-up, not sure if these are the preferred way to add cycle detection. In any case, wanted to get this on your radar. Thank you for LiCK!!

gewang commented 1 year ago

PS: recent updates to the implementation of Machine.add() in chuck-1.5.1.3-dev greatly speeds up loading LiCK (on macOS and possibly also on Linux). This is quite apparent when running chuck import.ck tests.ck using chuck-1.5.1.2 release versus 1.5.1.3-dev (after 69ce7ed).

heuermh commented 1 year ago

Thank you, @gewang! Sorry about the non-deterministic tests 🤦