/// <summary>
        /// Remove all the out-edges of vertex u for which the predicate pred 
        /// returns true.
        /// </summary>
        /// <param name="u">vertex</param>
        /// <param name="pred">edge predicate</param>
        public virtual void RemoveOutEdgeIf(DataTableVertex u, IEdgePredicate pred)
        {
            if (u==null)
                throw new ArgumentNullException("u");
            if (pred == null)
                throw new ArgumentNullException("pred");

            DataRelationEdgeCollection edges = this.vertexOutEdges[u];
            DataRelationEdgeCollection removedEdges = new DataRelationEdgeCollection();
            foreach(DataRelationEdge e in edges)
            {
                if (pred.Test(e))
                    removedEdges.Add(e);
            }

            foreach(DataRelationEdge e in removedEdges)
                this.RemoveEdge(e);
        }
        /// <summary>
        /// Remove the edge (u,v) from the graph. 
        /// If the graph allows parallel edges this remove all occurrences of 
        /// (u,v).
        /// </summary>
        /// <param name="u">source vertex</param>
        /// <param name="v">target vertex</param>
        public virtual void RemoveEdge(DataTableVertex u, DataTableVertex v)
        {
            if (u == null)
                throw new ArgumentNullException("u");
            if (v == null)
                throw new ArgumentNullException("v");

            this.version++;
            // getting out-edges
            DataRelationEdgeCollection outEdges = this.vertexOutEdges[u];

            // marking edges to remove
            DataRelationEdgeCollection removedEdges = new DataRelationEdgeCollection();
            foreach(DataRelationEdge e in outEdges)
            {
                if (e.Target == v)
                    removedEdges.Add(e);
            }
            //removing out-edges
            foreach(DataRelationEdge e in removedEdges)
                outEdges.Remove(e);

            removedEdges.Clear();
            DataRelationEdgeCollection inEdges = this.vertexInEdges[v];
            foreach(DataRelationEdge e in inEdges)
            {
                if (e.Source == u)
                    removedEdges.Add(e);
            }
            //removing in-edges
            foreach(DataRelationEdge e in removedEdges)
                inEdges.Remove(e);
        }
        /// <summary>
        /// Remove all the edges from graph g for which the predicate pred
        /// returns true.
        /// </summary>
        /// <param name="pred">edge predicate</param>
        public virtual void RemoveEdgeIf(IEdgePredicate pred)
        {
            if (pred == null)
                throw new ArgumentNullException("predicate");

            // marking edge for removal
            DataRelationEdgeCollection removedEdges = new DataRelationEdgeCollection();
            foreach(DataRelationEdge e in Edges)
            {
                if (pred.Test(e))
                    removedEdges.Add(e);
            }

            // removing edges
            foreach(DataRelationEdge e in removedEdges)
                this.RemoveEdge(e);
        }
 /// <summary>
 /// Create a new enumerator on the collection
 /// </summary>
 /// <param name="collection">collection to enumerate</param>
 public DataRelationEdgeEnumerator(DataRelationEdgeCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }