topological sorting methods applied.