/// <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 FilteredVertexListGraph(
     IVertexListGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g, edgePredicate, vertexPredicate)
 {
 }
 /// <summary>
 /// Construct a graph that filters in-edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g or vertexPredicate is null
 /// </exception>
 public FilteredVertexListGraph(
     IVertexListGraph g,
     IVertexPredicate vertexPredicate
     )
     : base(g,new KeepAllEdgesPredicate(), vertexPredicate)
 {
 }
Esempio n. 4
0
		/// <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 FilteredBidirectionalGraph(
     IBidirectionalGraph g,
     IEdgePredicate edgePredicate,
     IVertexPredicate vertexPredicate)
     : base(g, edgePredicate, vertexPredicate)
 {
 }
Esempio n. 6
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 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 in-edges
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="vertexPredicate">vertex predicate</param>
 /// <exception cref="ArgumentNullException">
 /// g or vertexPredicate is null
 /// </exception>
 public FilteredVertexListGraph(
     IVertexListGraph g,
     IVertexPredicate vertexPredicate
     )
     : base(g, new KeepAllEdgesPredicate(), vertexPredicate)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Constructs a new <see cref="NotVertexPredicate"/>.
 /// </summary>
 /// <param name="predicate">predicate to invert</param>
 public NotVertexPredicate(IVertexPredicate predicate)
 {
     if (predicate == null)
     {
         throw new ArgumentNullException("predicate");
     }
     this.predicate = predicate;
 }
Esempio n. 10
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);
 }
Esempio n. 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);
 }
Esempio n. 12
0
        /// <summary>
        /// Returns the collection of vertices that matches the predicate
        /// </summary>
        /// <param name="vp">vertex predicate</param>
        /// <returns>enumerable colleciton of vertices that matches the
        /// criteron</returns>
        /// <exception cref="ArgumentNullException">vp is null</exception>
        public IVertexEnumerable SelectVertices(IVertexPredicate vp)
        {
            if (vp == null)
            {
                throw new ArgumentNullException("vertex predicate");
            }

            return(new FilteredVertexEnumerable(Vertices, vp));
        }
Esempio n. 13
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 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);
		}
Esempio n. 15
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 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 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;
        }
Esempio n. 18
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="ec">base collection</param>
        /// <param name="ep">predicate</param>
        /// <exception cref="ArgumentNullException">ec or ep null</exception>
        public FilteredVertexEnumerable(VertexCollection ec, IVertexPredicate ep)
        {
            if (ec == null)
                throw new ArgumentNullException("Vertex collection");
            if (ep == null)
                throw new ArgumentNullException("Vertex predicate");

            m_VertexCollection = ec;
            m_VertexPredicate = ep;
        }
 /// <summary>
 /// Create an adjacency filtered graph
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="vp">vertex predicate</param>
 public FilteredAdjacencyGraph(
     IAdjacencyGraph g,
     IVertexPredicate vp
     )
 {
     if (g==null)
         throw new ArgumentNullException("g is null");
     m_AdjacencyGraph = g;
     VertexPredicate = vp;
 }
Esempio n. 20
0
 /// <summary>
 /// Create an adjacency filtered graph
 /// </summary>
 /// <param name="g">graph to filter</param>
 /// <param name="vp">vertex predicate</param>
 public FilteredAdjacencyGraph(
     IAdjacencyGraph g,
     IVertexPredicate vp
     )
 {
     if (g == null)
     {
         throw new ArgumentNullException("g is null");
     }
     m_AdjacencyGraph = g;
     VertexPredicate  = vp;
 }
Esempio n. 21
0
        /// <summary>
        /// Returns the first vertex that matches the predicate
        /// </summary>
        /// <param name="vp">vertex predicate</param>
        /// <returns>null if not found, otherwize the first vertex that
        /// matches the predicate.</returns>
        /// <exception cref="ArgumentNullException">vp is null</exception>
        public IVertex SelectSingleVertex(IVertexPredicate vp)
        {
            if (vp == null)
            {
                throw new ArgumentNullException("vertex predicate");
            }

            foreach (IVertex v in SelectVertices(vp))
            {
                return(v);
            }
            return(null);
        }
Esempio n. 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;
        }
Esempio n. 23
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="ec">base collection</param>
        /// <param name="ep">predicate</param>
        /// <exception cref="ArgumentNullException">ec or ep null</exception>
        public FilteredVertexEnumerable(VertexCollection ec, IVertexPredicate ep)
        {
            if (ec == null)
            {
                throw new ArgumentNullException("Vertex collection");
            }
            if (ep == null)
            {
                throw new ArgumentNullException("Vertex predicate");
            }

            m_VertexCollection = ec;
            m_VertexPredicate  = ep;
        }
Esempio n. 24
0
        /// <summary>
        /// Returns the first vertex of the enumerable that matches the predicate.
        /// </summary>
        /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param>
        /// <param name="pred">vertex predicate</param>
        /// <returns>first vertex if any, otherwise a null reference</returns>
        public static IVertex FirstVertexIf(IVertexEnumerable vertices, IVertexPredicate pred)
        {
            if (vertices == null)
            {
                throw new ArgumentNullException("vertices");
            }
            if (pred == null)
            {
                throw new ArgumentNullException("pred");
            }

            IVertexEnumerator en = vertices.GetEnumerator();

            while (en.MoveNext())
            {
                if (pred.Test(en.Current))
                {
                    return(en.Current);
                }
            }
            return(null);
        }
Esempio n. 25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="vp"></param>
 /// <returns></returns>
 public IVertexEnumerable SelectVertices(IVertexPredicate vp)
 {
     return(Wrapped.SelectVertices(vp));
 }
Esempio n. 26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="vp"></param>
 /// <returns></returns>
 public IVertex SelectSingleVertex(IVertexPredicate vp)
 {
     return(Wrapped.SelectSingleVertex(vp));
 }
Esempio n. 27
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);
 }
Esempio n. 28
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);
 }
Esempio n. 29
0
 /// <summary>
 /// Negates a predicate
 /// </summary>
 /// <param name="predicate"></param>
 /// <returns></returns>
 public static NotVertexPredicate Not(IVertexPredicate predicate)
 {
     return new NotVertexPredicate(predicate);
 }
Esempio n. 30
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));
 }
Esempio n. 31
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="e">Base enumerator</param>
 /// <param name="p">predicate</param>
 public Enumerator(VertexCollection.Enumerator e, IVertexPredicate p)
 {
     m_Enumerator = e;
     m_Predicate = p;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="vp"></param>
 /// <returns></returns>
 public IVertexEnumerable SelectVertices(IVertexPredicate vp)
 {
     return Wrapped.SelectVertices(vp);
 }
Esempio n. 33
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="e">Base enumerator</param>
 /// <param name="p">predicate</param>
 public Enumerator(VertexCollection.Enumerator e, IVertexPredicate p)
 {
     m_Enumerator = e;
     m_Predicate  = p;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="vp"></param>
 /// <returns></returns>
 public IVertex SelectSingleVertex(IVertexPredicate vp)
 {
     return Wrapped.SelectSingleVertex(vp);
 }
 public IVertex SelectSingleVertex(IVertexPredicate vp)
 {
     if (vp == null)
     {
         throw new ArgumentNullException("vertex predicate");
     }
     IVertexEnumerator enumerator = this.SelectVertices(vp).GetEnumerator();
     while (enumerator.MoveNext())
     {
         return enumerator.get_Current();
     }
     return null;
 }
Esempio n. 36
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));
 }
Esempio n. 37
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="e">Base enumerator</param>
 /// <param name="p">predicate</param>
 public Enumerator(IVertexEnumerator e, IVertexPredicate p)
 {
     m_Enumerator = e;
     m_Predicate  = p;
 }
Esempio n. 38
0
 IVertex IFilteredVertexListGraph.SelectSingleVertex(IVertexPredicate vp)
 {
     return this.SelectSingleVertex(vp);
 }
Esempio n. 39
0
        /// <summary>
        /// Returns the first vertex that matches the predicate
        /// </summary>
        /// <param name="vp">vertex predicate</param>
        /// <returns>null if not found, otherwize the first vertex that
        /// matches the predicate.</returns>
        /// <exception cref="ArgumentNullException">vp is null</exception>
        public IVertex SelectSingleVertex(IVertexPredicate vp)
        {
            if (vp == null)
                throw new ArgumentNullException("vertex predicate");

            foreach(IVertex v in SelectVertices(vp))
                return v;
            return null;
        }
 /// <summary>
 /// Constructs a new <see cref="NotVertexPredicate"/>.
 /// </summary>
 /// <param name="predicate">predicate to invert</param>
 public NotVertexPredicate(IVertexPredicate predicate)
 {
     if (predicate==null)
         throw new ArgumentNullException("predicate");
     this.predicate = predicate;
 }
Esempio n. 41
0
        /// <summary>
        /// Returns the first vertex of the enumerable that matches the predicate.
        /// </summary>
        /// <param name="vertices">enumerable collection of <see cref="IVertex"/></param>
        /// <param name="pred">vertex predicate</param>
        /// <returns>first vertex if any, otherwise a null reference</returns>
        public static IVertex FirstVertexIf(IVertexEnumerable vertices, IVertexPredicate pred)
        {
            if (vertices==null)
                throw new ArgumentNullException("vertices");
            if (pred==null)
                throw new ArgumentNullException("pred");

            IVertexEnumerator en = vertices.GetEnumerator();
            while(en.MoveNext())
            {
                if (pred.Test(en.Current))
                    return en.Current;
            }
            return null;
        }
Esempio n. 42
0
			/// <summary>
			/// Constructor
			/// </summary>
			/// <param name="e">Base enumerator</param>
			/// <param name="p">predicate</param>
			public Enumerator(IVertexEnumerator e, IVertexPredicate p)
			{
				m_Enumerator = e;
				m_Predicate = p;
			}
Esempio n. 43
0
        /// <summary>
        /// Returns the collection of vertices that matches the predicate
        /// </summary>
        /// <param name="vp">vertex predicate</param>
        /// <returns>enumerable colleciton of vertices that matches the 
        /// criteron</returns>
        /// <exception cref="ArgumentNullException">vp is null</exception>
        public IVertexEnumerable SelectVertices(IVertexPredicate vp)
        {
            if (vp == null)
                throw new ArgumentNullException("vertex predicate");

            return new FilteredVertexEnumerable(Vertices,vp);
        }
Esempio n. 44
0
 /// <summary>
 /// Negates a predicate
 /// </summary>
 /// <param name="predicate"></param>
 /// <returns></returns>
 public static NotVertexPredicate Not(IVertexPredicate predicate)
 {
     return(new NotVertexPredicate(predicate));
 }