public SourceFirstTopologicalSortAlgorithm(
     IVertexAndEdgeListGraph visitedGraph
     )
 {
     this.visitedGraph = visitedGraph;
     this.heap = new PriorithizedVertexBuffer(this.inDegrees);
 }
		/// <summary>
		/// Builds a new Dijsktra searcher.
		/// </summary>
		/// <param name="g">The graph</param>
		/// <param name="weights">Edge weights</param>
		/// <exception cref="ArgumentNullException">Any argument is null</exception>
		/// <remarks>This algorithm uses the <seealso cref="BreadthFirstSearchAlgorithm"/>.</remarks>
		public DijkstraShortestPathAlgorithm(
			IVertexListGraph g, 
			EdgeDoubleDictionary weights
			)
		{
			if (g == null)
				throw new ArgumentNullException("g");
			if (weights == null)
				throw new ArgumentNullException("Weights");

			this.visitedGraph = g;
			this.colors = new VertexColorDictionary();
			this.distances = new VertexDoubleDictionary();
			this.weights = weights;
			this.vertexQueue = null;
		}
 protected void Initialize()
 {
     this.costs = new VertexDoubleDictionary();
     this.priorityQueue = new PriorithizedVertexBuffer(this.costs);
     this.unvisitedSuccessorCounts = new VertexIntDictionary();
     this.states.Clear();
     VertexCollection.Enumerator enumerator = this.goals.GetEnumerator();
     while (enumerator.MoveNext())
     {
         IVertex vertex = enumerator.get_Current();
         this.costs.Add(vertex, 0.0);
         this.priorityQueue.Push(vertex);
     }
     IVertexEnumerator enumerator2 = this.NotGoals.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IVertex vertex2 = enumerator2.get_Current();
         this.costs.Add(vertex2, double.PositiveInfinity);
     }
     IVertexEnumerator enumerator3 = this.TestGraph.ChoicePoints.GetEnumerator();
     while (enumerator3.MoveNext())
     {
         IVertex vertex3 = enumerator3.get_Current();
         this.unvisitedSuccessorCounts.Add(vertex3, this.testGraph.Graph.OutDegree(vertex3));
     }
     IVertexEnumerator enumerator4 = this.TestGraph.Graph.get_Vertices().GetEnumerator();
     while (enumerator4.MoveNext())
     {
         IVertex vertex4 = enumerator4.get_Current();
         this.states.Add(vertex4, null);
     }
 }
        /// <summary>
        /// Builds a new Dijsktra searcher.
        /// </summary>
        /// <param name="g">The graph</param>
        /// <param name="weights">Edge weights</param>
        /// <exception cref="ArgumentNullException">Any argument is null</exception>
        /// <remarks>This algorithm uses the <seealso cref="BreadthFirstSearchAlgorithm"/>.</remarks>
        public DijkstraShortestPathAlgorithm(
            IVertexListGraph g,
            EdgeDoubleDictionary weights
            )
        {
            if (g == null)
                throw new ArgumentNullException("g");
            if (weights == null)
                throw new ArgumentNullException("Weights");

            m_VisitedGraph = g;
            m_Colors = new VertexColorDictionary();
            m_Distances = new VertexDoubleDictionary();
            m_Predecessors = new VertexVertexDictionary();
            m_Weights = weights;
            m_VertexQueue = null;
        }
        internal void ComputeNoInit(IVertex s)
        {
            m_VertexQueue = new PriorithizedVertexBuffer(m_Distances);
            BreadthFirstSearchAlgorithm bfs = new BreadthFirstSearchAlgorithm(
                VisitedGraph,
                m_VertexQueue,
                Colors
                );

            bfs.InitializeVertex += this.InitializeVertex;
            bfs.DiscoverVertex += this.DiscoverVertex;
            bfs.ExamineEdge += this.ExamineEdge;
            bfs.ExamineVertex += this.ExamineVertex;
            bfs.FinishVertex += this.FinishVertex;

            bfs.TreeEdge += new EdgeHandler(this.TreeEdge);
            bfs.GrayTarget += new EdgeHandler(this.GrayTarget);

            bfs.Visit(s);
        }
 public void ComputeNoInit(IVertex s)
 {
     this.vertexQueue = new PriorithizedVertexBuffer(this.distances);
     BreadthFirstSearchAlgorithm algorithm = new BreadthFirstSearchAlgorithm(this.VisitedGraph, this.vertexQueue, this.Colors);
     algorithm.InitializeVertex += this.InitializeVertex;
     algorithm.DiscoverVertex += this.DiscoverVertex;
     algorithm.ExamineEdge += this.ExamineEdge;
     algorithm.ExamineVertex += this.ExamineVertex;
     algorithm.FinishVertex += this.FinishVertex;
     algorithm.TreeEdge += new EdgeEventHandler(this, (IntPtr) this.TreeEdge);
     algorithm.GrayTarget += new EdgeEventHandler(this, (IntPtr) this.GrayTarget);
     algorithm.Visit(s);
 }