コード例 #1
0
  private void createEdges() {
    City c1, c2;

    for (int i = 0; i < allCities.size(); i++) {
      for (int j = 0; j < allCities.size(); j++) {
        if (i == j) continue;

        c1 = allCities.get(i);
        c2 = allCities.get(j);

        c1.addCityToMap(c2);
        c2.addCityToMap(c1);

        // System.out.println("c1 " + c1.getName() + " , c2 " + c2.getName() + " dist : " +
        // c1.getdMap().get(c2));
      }
    }
    sortEdges(allCities);
  }
コード例 #2
0
 private void sortEdges(List<City> allCities) {
   for (City city : allCities) {
     city.setdMap(sortByValues(city.getdMap()));
   }
 }