/// <summary>
        /// Induce a subgraph from the given nodes.
        /// </summary>
        /// <param name="nodes">Nodes to induce subgraph on.</param>
        /// <returns>A new graph which is the subgraph of this graph containing the specified nodes and the edges from this graph which have both endpoints in the specified nodes.</returns>
        public MultiDirectedGraph <TNode, TLabel> Induce(IEnumerable <TNode> nodes)
        {
            var induced = new MultiDirectedGraph <TNode, TLabel>();

            // Add nodes
            foreach (var node in nodes)
            {
                induced.AddNode(node, nodeLabel[node]);
            }

            // Add those edges with source and target nodes present in induced graph
            foreach (var s in nodes)
            {
                foreach (var e in outgoing[s])
                {
                    var t = target[e];
                    if (induced.HasNode(t))
                    {
                        induced.AddEdge(s, t, edgeLabel[e]);
                    }
                }
            }

            return(induced);
        }
        /// <summary>
        /// Clones a graph and transforms the nodes using the specified function.
        /// </summary>
        /// <typeparam name="TNewNode"></typeparam>
        /// <param name="convert"></param>
        /// <returns></returns>
        public MultiDirectedGraph <TNewNode, TLabel> Clone <TNewNode>(Func <TNode, TNewNode> convert)
        {
            var clone = new MultiDirectedGraph <TNewNode, TLabel>();

            // Add nodes
            foreach (var node in nodes)
            {
                clone.AddNode(convert(node), nodeLabel[node]);
            }

            // Add edges
            foreach (var s in nodes)
            {
                foreach (var e in outgoing[s])
                {
                    var t = target[e];
                    clone.AddEdge(convert(s), convert(t), edgeLabel[e]);
                }
            }

            return(clone);
        }
        /// <summary>
        /// Clones the graph.
        /// </summary>
        /// <returns>A new graph which is an exact copy of this graph.</returns>
        public MultiDirectedGraph <TNode, TLabel> Clone()
        {
            var clone = new MultiDirectedGraph <TNode, TLabel>();

            // Add nodes
            foreach (var node in nodes)
            {
                clone.AddNode(node, nodeLabel[node]);
            }

            // Add edges
            foreach (var s in nodes)
            {
                foreach (var e in outgoing[s])
                {
                    var t = target[e];
                    clone.AddEdge(s, t, edgeLabel[e]);
                }
            }

            return(clone);
        }