static <V> List<V> topologicalSort(DirectedGraph<V> g) {
        List<V> ts = new LinkedList<>();
        int[] inDegree = new int[g.getNumberOfVertexes()];
        Queue<V> q = new LinkedList<>();
        List<V> vl = g.getVertexList();
        int i = 0;
        int j = 0;
        List<V> temp = new LinkedList<>();

        for (V v : g.getVertexList()) {
            inDegree[i] = g.getInDegree(v);
            if (inDegree[i] == 0) {
                q.add(v);
            }
            i++;
        }

        while (q.size() != 0) {
            V v = q.poll();
            ts.add(v);
            temp = g.getSuccessorVertexList(v);

            for (V w : temp) {
                j = 0;
                for (V t : vl) {
                    if (t == w) {
                        break;
                    }
                    j++;

                }
                if (--inDegree[j] == 0) {
                    q.add(w);
                }

            }

        }

        if (ts.size() != g.getNumberOfVertexes()) {
            throw new IllegalStateException("Zyklus gefunden!");
        } else {
            return ts;

        }

    }