updated comments and resolved error of outputting a toposort even
though the graph was cyclic.