topological sort made easy with vector<int>::reverse_iterator