internal DiGraphVertex(DiGraph <T> graph, T vertexKey)
            {
                if (!graph.vertexIndices.ContainsKey(vertexKey))
                {
                    throw new ArgumentException("vertex is not in this graph.");
                }

                this.graph       = graph;
                this.vertexKey   = vertexKey;
                this.vertexIndex = graph.vertexIndices[vertexKey];
            }
        public DiGraph <T> Clone()
        {
            var graph = new DiGraph <T>();

            foreach (var vertex in this)
            {
                graph.AddVertex(vertex);
            }

            foreach (var vertex in this)
            {
                foreach (var edge in OutEdges(vertex))
                {
                    graph.AddEdge(vertex, edge);
                }
            }

            return(graph);
        }