# How to compute the routing through N addresses/coordinates?

I have a set of N coordinates (addresses). My goal is to compute the shortest driving route through the set of coordinates, where the algorithm (not the user) decides which of the N coordinates should be the start point and which of the N - 1 coordinates (excluding the start point) should be the end point.

Can this be done and which algorithms are used for this kind of routing?

By assuming that the routing can be done using the arial distance between the coordinates instead of roads, how could I then solve my problem?

At this stage of my questioning, I am trying to determine how to solve the problem in theory but the tools at hand are a PostGIS database and anything I can implement my self in C# .NET. If any free libraries can help me, then they can be considered too :)

-

## 2 Answers

Travelling Salesman is supported by pgRouting: http://www.pgrouting.org/docs/1.x/index.html, so no need to implement something yourself if you alread have PostGIS at hand.

-

This is known as the Travelling Salesman Problem. To do want you want, you would probably first calculate all your driving distances between the N points, then use one of the known algorithms to solve the problem.

-