## Traveling Salesman Problem - w/ matrix

Hello guys,

this is my first post here and I'm in a little trouble: I need to code a looks-like Traveling Salesman Problem. I have 12 cities and need to find the shortest path from anyone (user will choice) and back.

I think matrix is the best path to do this (I'm studying graphs right now, so i don't think i w/ fully understand). I have the matrix

Code:
```int matrix[12][12] = {
{0, 107, NULL, 95, NULL, 122, NULL, NULL, 108, NULL, 108, NULL},      // CITY 1
{NULL, 0, 8, 36, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},     // CITY 2
{NULL, 8, 0, NULL, NULL, 35, NULL, NULL, NULL, NULL, NULL, NULL},     // CITY 3
{95, 36, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 33, NULL, NULL},   // CITY 4
{NULL, NULL, NULL, NULL, 0, 70, 52, NULL, NULL, NULL, NULL, NULL},    // CITY 5
{122, NULL, 35, NULL, 70, NULL, NULL, NULL, NULL, NULL, NULL, NULL},  // CITY 6
{NULL, NULL, NULL, NULL, 52, NULL, 0, NULL, NULL, NULL, NULL, NULL},  // CITY 7
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 11, NULL, 19, NULL},    // CITY 8
{108, NULL, NULL, NULL, NULL, NULL, NULL, 11, NULL, NULL, 16, NULL},  // CITY 9
{NULL, NULL, NULL, 33, NULL, NULL, NULL, NULL, NULL, NULL, 18, NULL}, // CITY 10
{108, NULL, NULL, NULL, NULL, NULL, NULL, 19, 16, 18, 0, NULL},       // CITY 11
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0} // CITY 12
};```
But I don't know how can I start to search for the shortest path. I'm thinking in Dijkstra algorithm, but how can apply to a matrix?