fixed the test for topological_sort
merge and algorithmic additions