public Search_AStar(SparseGraph <TNode, TEdge> Graph, IHeuristic <SparseGraph <TNode, TEdge> > Heuristic, int Source, int Target) { this.Graph = Graph; this.bFound = false; this.Heuristic = Heuristic; SourceNodeIndex = Source; TargetNodeIndex = Target; int ActiveNodeCount = Graph.ActiveNodeCount(); int NodeCount = Graph.NodeCount(); ShortestPathTree = new List <TEdge>(NodeCount); SearchFrontier = new List <TEdge>(NodeCount); CostToThisNode = new List <double>(NodeCount); GCosts = new List <double>(NodeCount); FCosts = new List <double>(NodeCount); // not sure i need to initialize these...nt); for (int i = 0; i < NodeCount; i++) { ShortestPathTree.Insert(i, null); SearchFrontier.Insert(i, null); CostToThisNode.Insert(i, 0); FCosts.Insert(i, 0); GCosts.Insert(i, 0); } TimeSlicedQ = new IndexedPriorityQueueLow <double>(FCosts, Graph.NodeCount()); TimeSlicedQ.Insert(SourceNodeIndex); }
public GraphSearchDFS(SparseGraph <GraphNode, GraphEdge> Graph, int Source, int Target) { this.Graph = Graph; this.bFound = false; this.SourceNodeIndex = Source; this.TargetNodeIndex = Target; SpanningTree = new List <GraphEdge>(); VisitedNodes = new List <int>(); for (int i = 0; i < Graph.NodeCount(); i++) { VisitedNodes.Insert(i, (int)NodeStatus.Unvisited); } Route = new List <int>(Graph.NodeCount()); for (int i = 0; i < Graph.NodeCount(); i++) { Route.Insert(i, (int)NodeStatus.NoParentAssigned); } }
public GraphSearchDijkstra(SparseGraph <GraphNode, GraphEdge> Graph, int Source, int Target) { this.Graph = Graph; this.bFound = false; SourceNodeIndex = Source; TargetNodeIndex = Target; int ActiveNodeCount = Graph.ActiveNodeCount(); int NodeCount = Graph.NodeCount(); ShortestPathTree = new List <GraphEdge>(NodeCount); SearchFrontier = new List <GraphEdge>(NodeCount); CostToThisNode = new List <double>(ActiveNodeCount); for (int i = 0; i < NodeCount; i++) { ShortestPathTree.Insert(i, null); SearchFrontier.Insert(i, null); CostToThisNode.Insert(i, 0); } }