public List<V> dfs() {
        Map<V, Boolean> Vmarks = new HashMap<V, Boolean>();
        for(V v: neighbors.keySet())
            Vmarks.put(v, false);

        Stack<V> stack = new Stack<V>();
        LinkedList<V> vertexes = new LinkedList<V>();
        for (V vertex : neighbors.keySet()) {
            stack.push(vertex);
            while (!stack.isEmpty()) {
                V curVertex = stack.pop();
                if (!Vmarks.get(curVertex)) {
                    Vmarks.put(curVertex, true);
                    vertexes.add(curVertex);
                    List<E> outEdges = new LinkedList<E>();
                    for(E e: edges)
                        if(e.InVertex().equals(curVertex))
                            stack.push(e.OutVertex());
                }
            }
        }
        return vertexes;
    }