add topological sort