Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Finding My Summer Vacation's Shortest Path

CowboyRobot (671517) writes | more than 2 years ago

Programming 0

CowboyRobot writes "Clay Breshears at Dr. Dobb's has a fun formula for optimizing the drive between multiple cities. "Think of a map as an instance of a graph, the cities are the nodes and the roads between cities are the edges. The length of the road is the weight of the corresponding edge. The All-Pairs Shortest Path problem takes a graph of n nodes represented by an n x n weight matrix, W. The result is an n x n matrix, D (for distance), where the D[i][j] entry holds the minimum weight of the path from node i to node j. Entries in the W matrix can be zero, positive (if a direct edge lies between the two nodes), or the infinity value where there is no direct edge between the nodes.""
Link to Original Source

Sorry! There are no comments related to the filter you selected.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?