add topsort cycle detection tests