correctly implement and test depth_first_search and topological sorting
using dfs