I/O-Efficient Algorithms for Topological Sort and Related Problems