public static void DFS(WUGraph t, DFSVertex current, DFSVertex prev,
                         int[] maxOnPath, int maxEdge) {
    Neighbors neigh;
    int i;

    current.visited = true;
    maxOnPath[current.number] = maxEdge;
    neigh = t.getNeighbors(current);
    if (neigh != null) {
      for (i = 0; i < neigh.neighborList.length; i++) {
        DFSVertex next = (DFSVertex) neigh.neighborList[i];
        if (next.visited) {
          if ((next != current) && (next != prev)) {
            tree = false;
            return;
          }
        } else if (neigh.weightList[i] > maxEdge) {
          DFS(t, next, current, maxOnPath, neigh.weightList[i]);
        } else {
          DFS(t, next, current, maxOnPath, maxEdge);
        }
        if (!tree) {
          return;
        }
      }
    }
  }