/// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredBidirectionalGraph(
     IBidirectionalGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g,edgePredicate,vertexPredicate)
 {
 }
Exemple #2
0
        /// <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 void RemoveOutEdgeIf(IVertex u, IEdgePredicate pred)
        {
            if (u == null)
            {
                throw new ArgumentNullException("vertex u");
            }
            if (pred == null)
            {
                throw new ArgumentNullException("predicate");
            }

            EdgeCollection edges        = VertexOutEdges[u];
            EdgeCollection removedEdges = new EdgeCollection();

            foreach (IEdge e in edges)
            {
                if (pred.Test(e))
                {
                    removedEdges.Add(e);
                }
            }

            foreach (IEdge e in removedEdges)
            {
                RemoveEdge(e);
            }
        }
 /// <summary>
 /// Construct a graph that filters in-edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredVertexListGraph(
     IVertexListGraph g,
     IEdgePredicate edgePredicate
     )
     : base(g,edgePredicate)
 {
 }
		/// <summary>
		/// Construct a graph that filters edges
		/// </summary>
		/// <param name="g">graph to filter</param>
		/// <param name="edgePredicate">edge predicate</param>
		/// <param name="vertexPredicate">vertex predicate</param>
		/// <exception cref="ArgumentNullException">
		/// g or edgePredicate or vertexPredicate is null
		/// </exception>
		public FilteredEdgeListGraph(
			IEdgeListGraph g, 
			IEdgePredicate edgePredicate,
			IVertexPredicate vertexPredicate
			)
			: base(g,edgePredicate,vertexPredicate)
		{}
 /// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredVertexListGraph(
     IVertexListGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g, edgePredicate, vertexPredicate)
 {
 }
 /// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredBidirectionalGraph(
     IBidirectionalGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g, edgePredicate, vertexPredicate)
 {
 }
 /// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredIncidenceGraph(
     IIncidenceGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g,edgePredicate,vertexPredicate)
 {
 }
 /// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredIncidenceGraph(
     IIncidenceGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g, edgePredicate, vertexPredicate)
 {
 }
 /// <summary>
 /// Construct a graph that filters edges and out-edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate"></param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredEdgeListAndIncidenceGraph(
     IEdgeListAndIncidenceGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate
     )
     : base(g,edgePredicate,vertexPredicate)
 {
     m_FilteredIncidenceGraph = new FilteredIncidenceGraph(g,edgePredicate,vertexPredicate);
 }
		/// <summary>
		/// Construct a graph that filters edges and vertices
		/// </summary>
		/// <param name="g">graph to filter</param>
		/// <param name="edgePredicate">edge predicate</param>
		/// <param name="vertexPredicate"></param>
		/// <exception cref="ArgumentNullException">
		/// g or edgePredicate is null
		/// </exception>
		public FilteredVertexAndEdgeListGraph(
			IVertexAndEdgeListGraph g,
			IEdgePredicate edgePredicate,
			IVertexPredicate vertexPredicate
			)
			: base(g,edgePredicate,vertexPredicate)
		{
			this.filteredEdgeList = new FilteredEdgeListGraph(g,edgePredicate);
		}
Exemple #11
0
 /// <summary>
 /// Construct a graph that filters edges and out-edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate"></param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredEdgeListAndIncidenceGraph(
     IEdgeListAndIncidenceGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate
     )
     : base(g, edgePredicate, vertexPredicate)
 {
     m_FilteredIncidenceGraph = new FilteredIncidenceGraph(g, edgePredicate, vertexPredicate);
 }
Exemple #12
0
 /// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredGraph(
     IGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
 {
     Graph           = g;
     EdgePredicate   = edgePredicate;
     VertexPredicate = vertexPredicate;
 }
 /// <summary>
 /// Construct a filtered graph with an edge and a vertex predicate.
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g, edgePredicate or vertexPredicate are null
 /// </exception>
 public FilteredGraph(
     IGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
 {
     Graph = g;
     EdgePredicate = edgePredicate;
     VertexPredicate = vertexPredicate;
 }
Exemple #14
0
        /// <summary>
        /// Returns the collection of edges that matches the predicate
        /// </summary>
        /// <param name="ep">Edge predicate</param>
        /// <returns>enumerable colleciton of vertices that matches the
        /// criteron</returns>
        /// <exception cref="ArgumentNullException">ep is null</exception>
        public FilteredEdgeEnumerable SelectEdges(IEdgePredicate ep)
        {
            if (ep == null)
            {
                throw new ArgumentNullException("edge predicate");
            }

            return(new FilteredEdgeEnumerable(Edges, ep));
        }
Exemple #15
0
 /// <summary>
 /// Construct a graph that filters edges and vertices
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <param name="vertexPredicate"></param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredVertexAndEdgeListGraph(
     IVertexAndEdgeListGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate
     )
     : base(g, edgePredicate, vertexPredicate)
 {
     this.filteredEdgeList = new FilteredEdgeListGraph(g, edgePredicate);
 }
        /// <summary>
        /// Construct a new predicate.
        /// </summary>
        /// <param name="ep">the edge predicate</param>
        /// <param name="vp">the source vertex predicate</param>
        /// <exception cref="ArgumentNullException">ep or vp is null</exception>
        public InEdgePredicate(IEdgePredicate ep, IVertexPredicate vp)
        {
            if (ep == null)
                throw new ArgumentNullException("Edge predicate");
            if (vp == null)
                throw new ArgumentNullException("Vertex predicate");

            m_EdgePredicate = ep;
            m_VertexPredicate = vp;
        }
        /// <summary>
        /// Filtered edge collection
        /// </summary>
        /// <param name="ec">base collection</param>
        /// <param name="ep">filtering predicate</param>
        public FilteredEdgeEnumerable(EdgeCollection ec, IEdgePredicate ep)
        {
            if (ec == null)
                throw new ArgumentNullException("edge collection");
            if (ep == null)
                throw new ArgumentNullException("edge predicate");

            m_EdgeCollection = ec;
            m_EdgePredicate = ep;
        }
 public RandomWalkAlgorithm(IVertexListGraph g)
 {
     this.visitedGraph = null;
     this.endPredicate = null;
     this.edgeChain = new NormalizedMarkovEdgeChain();
     this.rnd = new Random((int) DateTime.Now.Ticks);
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     this.visitedGraph = g;
 }
Exemple #19
0
 /// <summary>
 /// Returns the first Edge that matches the predicate
 /// </summary>
 /// <param name="ep">Edge predicate</param>
 /// <returns>null if not found, otherwize the first Edge that
 /// matches the predicate.</returns>
 /// <exception cref="ArgumentNullException">ep is null</exception>
 public IEdge SelectSingleEdge(IEdgePredicate ep)
 {
     if (ep == null)
     {
         throw new ArgumentNullException("edge predicate");
     }
     foreach (IEdge e in SelectEdges(ep))
     {
         return(e);
     }
     return(null);
 }
Exemple #20
0
        /// <summary>
        /// Remove edge satifying the predicate
        /// </summary>
        /// <param name="ep"></param>
        public virtual void RemoveEdgeIf(IEdgePredicate ep)
        {
            if (ep == null)
            {
                throw new ArgumentNullException("ep");
            }

            Wrapped.RemoveEdgeIf(ep);
            if (Parent != null)
            {
                Parent.RemoveEdgeIf(ep);
            }
        }
Exemple #21
0
        /// <summary>
        /// Returns the collection of out-edges that matches the predicate
        /// </summary>
        /// <param name="v"></param>
        /// <param name="ep">Edge predicate</param>
        /// <returns>enumerable colleciton of vertices that matches the
        /// criteron</returns>
        /// <exception cref="ArgumentNullException">v or ep is null</exception>
        public FilteredEdgeEnumerable SelectOutEdges(IVertex v, IEdgePredicate ep)
        {
            if (v == null)
            {
                throw new ArgumentNullException("vertex");
            }
            if (ep == null)
            {
                throw new ArgumentNullException("edge predicate");
            }

            return(new FilteredEdgeEnumerable(OutEdges(v), ep));
        }
Exemple #22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ep"></param>
        /// <param name="vp"></param>
        public InEdgePredicate(IEdgePredicate ep, IVertexPredicate vp)
        {
            if (ep == null)
            {
                throw new ArgumentNullException("Edge predicate");
            }
            if (vp == null)
            {
                throw new ArgumentNullException("Vertex predicate");
            }

            m_EdgePredicate   = ep;
            m_VertexPredicate = vp;
        }
        /// <summary>
        /// Filtered edge collection
        /// </summary>
        /// <param name="ec">base collection</param>
        /// <param name="ep">filtering predicate</param>
        public FilteredEdgeEnumerable(IEdgeEnumerable ec, IEdgePredicate ep)
        {
            if (ec == null)
            {
                throw new ArgumentNullException("edge collection");
            }
            if (ep == null)
            {
                throw new ArgumentNullException("edge predicate");
            }

            m_EdgeCollection = ec;
            m_EdgePredicate  = ep;
        }
Exemple #24
0
        /// <summary>
        /// Remove all the edges from graph g for which the predicate pred
        /// returns true.
        /// </summary>
        /// <param name="pred">edge predicate</param>
        public void RemoveEdgeIf(IEdgePredicate pred)
        {
            if (pred == null)
            {
                throw new ArgumentNullException("predicate");
            }

            // marking edge for removal
            EdgeCollection removedEdges = new EdgeCollection();

            foreach (IEdge e in Edges)
            {
                if (pred.Test(e))
                {
                    removedEdges.Add(e);
                }
            }

            // removing edges
            foreach (IEdge e in removedEdges)
            {
                RemoveEdge(e);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 /// <param name="p"></param>
 public Enumerator(IEdgeEnumerator e, IEdgePredicate p)
 {
     m_Enumerator = e;
     m_Predicate  = p;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ep"></param>
 /// <returns></returns>
 public IEdge SelectSingleEdge(IEdgePredicate ep)
 {
     return Wrapped.SelectSingleEdge(ep);
 }
Exemple #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ep"></param>
 /// <returns></returns>
 IEdgeEnumerable IFilteredEdgeListGraph.SelectEdges(IEdgePredicate ep)
 {
     return(this.SelectEdges(ep));
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 IEdgeEnumerable IFilteredBidirectionalGraph.SelectInEdges(IVertex v, IEdgePredicate ep)
 {
     return this.SelectInEdges(v,ep);
 }
Exemple #29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 IEdgeEnumerable IFilteredIncidenceGraph.SelectOutEdges(IVertex v, IEdgePredicate ep)
 {
     return(this.SelectOutEdges(v, ep));
 }
Exemple #30
0
 /// <summary>
 /// Construct a graph that filters edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredGraph(IGraph g, IEdgePredicate edgePredicate)
 {
     Graph           = g;
     EdgePredicate   = edgePredicate;
     VertexPredicate = new KeepAllVerticesPredicate();
 }
Exemple #31
0
 /// <summary>
 /// Gets a filtered <see cref="IEdgeEnumerable"/> collection of edges.
 /// </summary>
 /// <param name="ep">edge predicate</param>
 /// <returns>filetered collection</returns>
 public IEdgeEnumerable SelectEdges(IEdgePredicate ep)
 {
     return(Wrapped.SelectEdges(ep));
 }
Exemple #32
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ep"></param>
 /// <returns></returns>
 public IEdge SelectSingleEdge(IEdgePredicate ep)
 {
     return(Wrapped.SelectSingleEdge(ep));
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 public IEdgeEnumerable SelectOutEdges(IVertex v, IEdgePredicate ep)
 {
     return Wrapped.SelectOutEdges(v,ep);
 }
Exemple #34
0
 /// <summary>
 /// Creates a predicate that check the edge and the edge target
 /// </summary>
 /// <param name="ep">edge predicate to apply to the edge</param>
 /// <param name="vp">vertex predicate to apply to the edge target</param>
 /// <returns>out-edge predicate</returns>
 public static OutEdgePredicate OutEdge(IEdgePredicate ep, IVertexPredicate vp)
 {
     return new OutEdgePredicate(ep,vp);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="e"></param>
 /// <param name="p"></param>
 public Enumerator(EdgeCollection.Enumerator e, IEdgePredicate p)
 {
     m_Enumerator = e;
     m_Predicate = p;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 IEdgeEnumerable IFilteredIncidenceGraph.SelectOutEdges(IVertex v, IEdgePredicate ep)
 {
     return this.SelectOutEdges(v,ep);
 }
Exemple #37
0
 /// <summary>
 /// Construct a graph that filters edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredEdgeListGraph(
     IEdgeListGraph g,
     IEdgePredicate edgePredicate)
     : base(g, edgePredicate)
 {
 }
 public virtual void RemoveEdgeIf(IEdgePredicate pred)
 {
     if (pred == null)
     {
         throw new ArgumentNullException("predicate");
     }
     EdgeCollection edges = new EdgeCollection();
     VertexEdgesEnumerator enumerator = this.Edges.GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         if (pred.Test(edge))
         {
             edges.Add(edge);
         }
     }
     EdgeCollection.Enumerator enumerator2 = edges.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IEdge e = enumerator2.get_Current();
         this.RemoveEdge(e);
     }
 }
Exemple #39
0
 /// <summary>
 /// Creates a predicate that check the edge and the edge source
 /// </summary>
 /// <param name="ep">edge predicate to apply to the edge</param>
 /// <param name="vp">vertex predicate to apply to the edge source</param>
 /// <returns>in-edge predicate</returns>
 public static InEdgePredicate InEdge(IEdgePredicate ep, IVertexPredicate vp)
 {
     return(new InEdgePredicate(ep, vp));
 }
Exemple #40
0
 /// <summary>
 /// Creates a predicate that check the edge and the edge source
 /// </summary>
 /// <param name="ep">edge predicate to apply to the edge</param>
 /// <param name="vp">vertex predicate to apply to the edge source</param>
 /// <returns>in-edge predicate</returns>
 public static InEdgePredicate InEdge(IEdgePredicate ep, IVertexPredicate vp)
 {
     return new InEdgePredicate(ep,vp);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 public IEdge SelectSingleOutEdge(IVertex v, IEdgePredicate ep)
 {
     return Wrapped.SelectSingleOutEdge(v,ep);
 }
Exemple #42
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 public IEdgeEnumerable SelectOutEdges(IVertex v, IEdgePredicate ep)
 {
     return(Wrapped.SelectOutEdges(v, ep));
 }
 public void RemoveInEdgeIf(IVertex u, IEdgePredicate pred)
 {
     if (u == null)
     {
         throw new ArgumentNullException("vertex u");
     }
     if (pred == null)
     {
         throw new ArgumentNullException("predicate");
     }
     EdgeCollection edges = this.VertexInEdges.get_Item(u);
     EdgeCollection edges2 = new EdgeCollection();
     EdgeCollection.Enumerator enumerator = edges.GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         if (pred.Test(edge))
         {
             edges2.Add(edge);
         }
     }
     EdgeCollection.Enumerator enumerator2 = edges2.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IEdge e = enumerator2.get_Current();
         this.RemoveEdge(e);
     }
 }
Exemple #44
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 public IEdge SelectSingleOutEdge(IVertex v, IEdgePredicate ep)
 {
     return(Wrapped.SelectSingleOutEdge(v, ep));
 }
 public IEdge SelectSingleInEdge(IVertex v, IEdgePredicate ep)
 {
     if (ep == null)
     {
         throw new ArgumentNullException("edge predicate");
     }
     FilteredEdgeEnumerable.Enumerator enumerator = this.SelectInEdges(v, ep).GetEnumerator();
     while (enumerator.MoveNext())
     {
         return enumerator.get_Current();
     }
     return null;
 }
 /// <summary>
 /// Construct a graph that filters edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="edgePredicate">edge predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g or edgePredicate is null
 /// </exception>
 public FilteredGraph(IGraph g, IEdgePredicate edgePredicate)
 {
     Graph = g;
     EdgePredicate = edgePredicate;
     VertexPredicate = new KeepAllVerticesPredicate();
 }
Exemple #47
0
 /// <summary>
 /// Creates a predicate that check the edge and the edge target
 /// </summary>
 /// <param name="ep">edge predicate to apply to the edge</param>
 /// <param name="vp">vertex predicate to apply to the edge target</param>
 /// <returns>out-edge predicate</returns>
 public static OutEdgePredicate OutEdge(IEdgePredicate ep, IVertexPredicate vp)
 {
     return(new OutEdgePredicate(ep, vp));
 }
        /// <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(IVertex u, IEdgePredicate pred)
        {
            if (u==null)
                throw new ArgumentNullException("vertex u");
            if (pred == null)
                throw new ArgumentNullException("predicate");

            EdgeCollection edges = VertexOutEdges[u];
            EdgeCollection removedEdges = new EdgeCollection();
            foreach(IEdge e in edges)
                if (pred.Test(e))
                    removedEdges.Add(e);

            foreach(IEdge e in removedEdges)
                RemoveEdge(e);
        }
        /// <summary>
        /// Returns the collection of out-edges that matches the predicate
        /// </summary>
        /// <param name="v"></param>
        /// <param name="ep">Edge predicate</param>
        /// <returns>enumerable colleciton of vertices that matches the 
        /// criteron</returns>
        /// <exception cref="ArgumentNullException">v or ep is null</exception>
        public FilteredEdgeEnumerable SelectOutEdges(IVertex v, IEdgePredicate ep)
        {
            if (v==null)
                throw new ArgumentNullException("vertex");
            if (ep==null)
                throw new ArgumentNullException("edge predicate");

            return new FilteredEdgeEnumerable(OutEdges(v),ep);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ep"></param>
 /// <returns></returns>
 IEdgeEnumerable IFilteredEdgeListGraph.SelectEdges(IEdgePredicate ep)
 {
     return this.SelectEdges(ep);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 /// <param name="p"></param>
 public Enumerator(EdgeCollection.Enumerator e, IEdgePredicate p)
 {
     m_Enumerator = e;
     m_Predicate  = p;
 }
        /// <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
            EdgeCollection removedEdges = new EdgeCollection();
            foreach(IEdge e in Edges)
            {
                if (pred.Test(e))
                    removedEdges.Add(e);
            }

            // removing edges
            foreach(IEdge e in removedEdges)
                RemoveEdge(e);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 /// <param name="ep"></param>
 /// <returns></returns>
 IEdgeEnumerable IFilteredBidirectionalGraph.SelectInEdges(IVertex v, IEdgePredicate ep)
 {
     return(this.SelectInEdges(v, ep));
 }
        /// <summary>
        /// Returns the collection of edges that matches the predicate
        /// </summary>
        /// <param name="ep">Edge predicate</param>
        /// <returns>enumerable colleciton of vertices that matches the 
        /// criteron</returns>
        /// <exception cref="ArgumentNullException">ep is null</exception>
        public FilteredEdgeEnumerable SelectEdges(IEdgePredicate ep)
        {
            if (ep == null)
                throw new ArgumentNullException("edge predicate");

            return new FilteredEdgeEnumerable(Edges,ep);
        }
        /// <summary>
        /// Remove out edge satisfying the predicate
        /// </summary>
        /// <param name="v"></param>
        /// <param name="ep"></param>
        public virtual void RemoveOutEdgeIf(IVertex v, IEdgePredicate ep)
        {
            if (v==null)
                throw new ArgumentNullException("v");
            if (ep==null)
                throw new ArgumentNullException("ep");

            Wrapped.RemoveOutEdgeIf(v,ep);
            if (Parent!=null)
                Parent.RemoveOutEdgeIf(v,ep);
        }
        /// <summary>
        /// Returns the first out-edge that matches the predicate
        /// </summary>
        /// <param name="v"></param>
        /// <param name="ep">Edge predicate</param>
        /// <returns>null if not found, otherwize the first Edge that
        /// matches the predicate.</returns>
        /// <exception cref="ArgumentNullException">v or ep is null</exception>
        public IEdge SelectSingleOutEdge(IVertex v, IEdgePredicate ep)
        {
            if (ep==null)
                throw new ArgumentNullException("edge predicate");

            foreach(IEdge e in SelectOutEdges(v,ep))
                return e;

            return null;
        }
 /// <summary>
 /// Gets a filtered <see cref="IEdgeEnumerable"/> collection of edges.
 /// </summary>
 /// <param name="ep">edge predicate</param>
 /// <returns>filetered collection</returns>
 public IEdgeEnumerable SelectEdges(IEdgePredicate ep)
 {
     return Wrapped.SelectEdges(ep);
 }