Calculates a route that passes through all nodes of the diagram. This implementation of the Traveling Salesperson Problem uses the nearest-neighbor heuristic.
Namespace: MindFusion.Diagramming
Assembly: PathFinder.js
SyntaxJavaScript
Copy Code
|
|---|
function generateShortestRoute ([weight]) |
function. A function that takes two DiagramNode arguments and returns a number that represents the distance between them. If not provided, the geometric distance between the nodes' centers is used.
RemarksThis method does not consider current links in the diagram. Instead, it uses geometrical distance between nodes or the result of weight function to suggest the sequence of nodes you should connect to generate approximate shortest path passing between them.
See Also