Dijkstras algorithm implamentation for tsp in java

This is a working implementation of Dijkstra's algorithm to solve a TSP problem (I understand that this is not the "best" solution for the problem, but for educational purposes, I've looked into this code written by Rishikesh Ingale)

Would someone be able to explain a little bit more detail about the implementation of the algorithm this way.

ArrayList u = new ArrayList(); //all cities

LinkedList v = new LinkedList(); //procesed cities

LinkedList order = new LinkedList();

double minDistance = 0;

int min;

double distance = 0;

for(int i = 0; i < cities.size(); i++) {

u.addAll(cities);

v.add(u.remove(i));

while(u.size() !=...

Read More »

By: StackOverFlow - 6 days ago

Related Posts