update topological sort