src/main/java/de/dfki/lt/loot/digraph/DiGraph.java
public List<Integer> topoSort(int start) throws CyclicGraphException {
    try {
      final List<Integer> result = new LinkedList<Integer>();
      dfs(start, new GraphVisitorAdapter<EI>() {
        private BitSet active = new BitSet();

        @Override
        public void discoverVertex(int v, Graph<EI> g) {
          active.set(v);
        }

        @Override
        public void finishVertex(int v, Graph<EI> g) {
          active.clear(v);
          result.add(0, v);
        }

        @Override
        public void nonTreeEdge(Edge<EI> e, Graph<EI> g) {
          if (active.get(e.getTarget()))
            throw new RuntimeException("Cycle");
        }
      });
      return result;
    }
    catch (RuntimeException rtex) {
      if (rtex.getMessage().equals("Cycle")) {
        throw new CyclicGraphException();
      } else {
        throw rtex;
      }
    }
  }
/** Returns the vertices reachable from start in topological order, in case 
   *  there are no cycles, otherwise throws a CyclicGraphException.
   *  @throws CyclicGraphException if the graph is cyclic
   */
Returns the vertices reachable from start in topological order, in case
there are no cycles, otherwise throws a CyclicGraphException.
@throws CyclicGraphException if the graph is cyclic
Returns the vertices reachable from start in topological order in case there are no cycles otherwise throws a CyclicGraphException . @throws CyclicGraphException if the graph is cyclic
public List<Integer> topoSort(int start) throws CyclicGraphException {
    try {
      final List<Integer> result = new LinkedList<Integer>();
      dfs(start, new GraphVisitorAdapter<EI>() {
        private BitSet active = new BitSet();
        @Override
        public void discoverVertex(int v, Graph<EI> g) {
          active.set(v);
        }
        @Override
        public void finishVertex(int v, Graph<EI> g) {
          active.clear(v);
          result.add(0, v);
        }
        @Override
        public void nonTreeEdge(Edge<EI> e, Graph<EI> g) {
          if (active.get(e.getTarget()))
            throw new RuntimeException("Cycle");
        }
      });
      return result;
    }
    catch (RuntimeException rtex) {
      if (rtex.getMessage().equals("Cycle")) {
        throw new CyclicGraphException();
      } else {
        throw rtex;
      }
    }
  }
public List < Integer > topoSort ( int start ) throws CyclicGraphException { try { final List < Integer > result = new LinkedList < Integer > ( ) ; dfs ( start , new GraphVisitorAdapter < EI > ( ) { private BitSet active = new BitSet ( ) ; @ Override public void discoverVertex ( int v , Graph < EI > g ) { active . set ( v ) ; } @ Override public void finishVertex ( int v , Graph < EI > g ) { active . clear ( v ) ; result . add ( 0 , v ) ; } @ Override public void nonTreeEdge ( Edge < EI > e , Graph < EI > g ) { if ( active . get ( e . getTarget ( ) ) ) throw new RuntimeException ( "Cycle" ) ; } } ) ; return result ; } catch ( RuntimeException rtex ) { if ( rtex . getMessage ( ) . equals ( "Cycle" ) ) { throw new CyclicGraphException ( ) ; } else { throw rtex ; } } }
Returns the vertices reachable from start in topological order, in case
  there are no cycles, otherwise throws a CyclicGraphException.
Returns the vertices reachable from start in topological order in case there are no cycles otherwise throws a CyclicGraphException .