Generating distance matrix using java
long[][] intArray = new long[waypoints.size()][waypoints.size()];
for(int i=0;i<intArray.length;i++) {
for(int j=0;j<=i;j++) {
intArray[j][i]=distance(waypoints.get(i),waypoints.get(j));
}
for(int j=0;j<=i;j++) {
intArray[i][j]=intArray[j][i];
}
}
for(int i=0;i<intArray.length;i++) {
for(int j=0;j<=i;j++) {
intArray[j][i]=distance(waypoints.get(i),waypoints.get(j));
}
for(int j=0;j<=i;j++) {
intArray[i][j]=intArray[j][i];
}
}
Comments
Post a Comment