remove old topo sort
check for acyclic graph