added topological ordering and longest path in dag functions.
edited longest path in dag function to account for backtracking. fixed topological ordering.