예제 #1
0
		/// <summary>
		/// Create a merged path. 
		/// </summary>
		/// <remarks>
		/// <para>
		/// This method creates an edge path that stops if an edge is not white
		/// or the edge has no more predecessors.
		/// </para>
		/// </remarks>
		/// <param name="se">end edge</param>
		/// <param name="colors">edge color dictionary</param>
		/// <returns>path to edge</returns>
		public EdgeCollection MergedPath(IEdge se,EdgeColorDictionary colors)
		{
			EdgeCollection path = new EdgeCollection();

			IEdge ec = se;
			GraphColor c = colors[ec];
			if (c!=GraphColor.White)
				return path;
			else
				colors[ec]=GraphColor.Black;

			path.Insert(0,ec);
			while (EdgePredecessors.Contains(ec))
			{
				IEdge e = EdgePredecessors[ec];
				c = colors[e];
				if (c!=GraphColor.White)
					return path;
				else
					colors[e]=GraphColor.Black;

				path.Insert(0,e);
				ec=e;
			}
			return path;
		}
예제 #2
0
		/// <summary>
		/// Returns the path leading to the vertex v.
		/// </summary>
		/// <param name="se">end of the path</param>
		/// <returns>path leading to v</returns>
		public EdgeCollection Path(IEdge se)
		{
			EdgeCollection path = new EdgeCollection();

			IEdge ec = se;
			path.Insert(0,ec);
			while (EdgePredecessors.Contains(ec))
			{
				IEdge e = EdgePredecessors[ec];
				path.Insert(0,e);
				ec=e;
			}
			return path;
		}
        /// <summary>
        /// Returns the path leading to the vertex v.
        /// </summary>
        /// <param name="v">end of the path</param>
        /// <returns>path leading to v</returns>
        public EdgeCollection Path(IVertex v)
        {
            EdgeCollection path = new EdgeCollection();

            IVertex vc = v;
            while (Predecessors.Contains(v))
            {
                IEdge e = Predecessors[v];
                path.Insert(0,e);
                v=e.Source;
            }

            return path;
        }
 public EdgeCollection Path(IVertex v)
 {
     EdgeCollection edges = new EdgeCollection();
     IVertex vertex = v;
     while (this.Predecessors.Contains(v))
     {
         IEdge edge = this.Predecessors.get_Item(v);
         edges.Insert(0, edge);
         v = edge.get_Source();
     }
     return edges;
 }
 public EdgeCollection Path(IEdge se)
 {
     EdgeCollection edges = new EdgeCollection();
     IEdge edge = se;
     edges.Insert(0, edge);
     while (this.EdgePredecessors.Contains(edge))
     {
         IEdge edge2 = this.EdgePredecessors.get_Item(edge);
         edges.Insert(0, edge2);
         edge = edge2;
     }
     return edges;
 }
 public EdgeCollection MergedPath(IEdge se, EdgeColorDictionary colors)
 {
     EdgeCollection edges = new EdgeCollection();
     IEdge edge = se;
     if (colors.get_Item(edge) == null)
     {
         colors.set_Item(edge, 1);
         edges.Insert(0, edge);
         while (this.EdgePredecessors.Contains(edge))
         {
             IEdge edge2 = this.EdgePredecessors.get_Item(edge);
             if (colors.get_Item(edge2) != null)
             {
                 return edges;
             }
             colors.set_Item(edge2, 1);
             edges.Insert(0, edge2);
             edge = edge2;
         }
     }
     return edges;
 }