// this searchs a graph using the distance between the target node and the // currently considered node as a heuristic. // This search is more commonly known as A* (pronounced Ay-Star) public Graph_SearchAStar(SparseGraph graph, int source, int target, CalculateHeuristic functionCalculate) : base(graph, source, target) { funcPointer = functionCalculate; int numNodes = m_Graph.NumNodes(); m_ShortestPathTree = new List <NavGraphEdge>(numNodes); m_SearchFrontier = new List <NavGraphEdge>(numNodes); m_GCosts = new List <double>(numNodes); m_FCosts = new List <double>(numNodes); for (int i = 0; i < numNodes; i++) { m_ShortestPathTree.Add(null); m_SearchFrontier.Add(null); m_GCosts.Add(0.0); m_FCosts.Add(0.0); } m_bFound = Search(); }
// this searchs a graph using the distance between the target node and the // currently considered node as a heuristic. // This search is more commonly known as A* (pronounced Ay-Star) public Graph_SearchAStar(SparseGraph graph, int source, int target, CalculateHeuristic functionCalculate) : base(graph, source, target) { funcPointer = functionCalculate; int numNodes = m_Graph.NumNodes(); m_ShortestPathTree = new List<NavGraphEdge>(numNodes); m_SearchFrontier = new List<NavGraphEdge>(numNodes); m_GCosts = new List<double>(numNodes); m_FCosts = new List<double>(numNodes); for (int i = 0; i < numNodes; i++) { m_ShortestPathTree.Add(null); m_SearchFrontier.Add(null); m_GCosts.Add(0.0); m_FCosts.Add(0.0); } m_bFound = Search(); }