private void BindRoles(Node origin, Node target, ManhattanGeometry geometry) { // Variable initialization _pathTo = new Dictionary <Node, Node>(); _origin = origin; _destination = target; // Bind RolePlayers to Roles // Set the initial node as current. Current = origin; CurrentIntersection = origin; DistanceGraph = origin; Map = geometry; // A set of the unvisited nodes called the unvisited set consisting of all the nodes // except the initial node. Unvisited = new UnvisitedNodes(geometry.Nodes); Unvisited.Remove(origin); // Assign to every node a tentative distance value: // Set it to zero for our initial node and to infinity for all other nodes. TentativeDistance = geometry.Nodes.ToDictionary(n => n, n => ManhattanGeometry.Infinity); TentativeDistance[origin] = 0; }
public CalculateShortestPath(Node origin, Node target, ManhattanGeometry geometry) { BindRoles(origin, target, geometry); }