Added topological sort and helper to check it.
Added test for count of returned number in topological sort.