[mod] raise CycleError in case of cyclic graph
[tests] add tests to polydag