Returns the node that is closest to the ANode parameter and has its Visited property equal to the Visited parameter.
This method assumes that every node Weight in the graph equals the length to get from ANode to that node. The InitializeNodes method can be used to set the weights of all nodes to MaxInt. The EnumerateShortestPaths and ShortestPath methods call this method as they build up the paths between Anode and every other node; they also set the Weight of each node to the shortest path length.
Note |
---|
The ClosestNode method only works with weighted graphs (a graph of TWeightedNodes and TWeightedEdges). |
Namespace: GGraph
Delphi |
public |
Parameters
ANode
Type: TGGraphNode
Visited
Type: Boolean
Type: TWeightedNode