code: private int dfsearch(int v, int[] pre, int[] ts, int count) {
          pre[v] = 0;
  
          for (Edge edge : graph[v]) {
              int t = edge.v2;
              if (pre[t] == -1) {
                  count = dfsearch(t, pre, ts, count);
              }
          }
  
          ts[count++] = v;
  
          return count;
      }
docs: Depth-first search of graph.
  @param v the start vertex.
  @param pre the array to store the mask if vertex has been visited.
  @param ts the array to store the reverse topological order.
  @param count the number of vertices have been visited before this search.
  @return the number of vertices that have been visited after this search.