code: private Set<Integer> getSuccessors(Graph g, Integer vertex) {
          if (g instanceof DirectedGraph) {
              DirectedGraph<?> dg = (DirectedGraph)g;
              return dg.successors(vertex);
          }
          else
              return Collections.<Integer>emptySet();
      }
docs: Returns those vertices that can be reached from {@code vertex} or the empty
  set if {@code g} is not a directed graph.