public static void computePaths(Station source) {
    source.setMinDistance(0.0);

    System.out.println("source = " + source);
    // Using PriorityQueue class with minDistance as a priority (see the comparator of Station)
    PriorityQueue<Station> vertexQueue = new PriorityQueue<Station>();
    vertexQueue.add(source);

    while (!vertexQueue.isEmpty()) {
      Station u = vertexQueue.poll();

      // Visit each NEIGHBOR edge exiting u
      for (Edge edge : u.getNeighborEdges()) {
        Station v = edge.getTarget();
        double weight = edge.getWeight();

        // relax the edge (u, v) :
        // if (u, v) is an edge and u is on the shortest path to v, then d(u) + w(u,v) = d(v).
        double distanceThroughU = u.getMinDistance() + weight;

        if (distanceThroughU < v.getMinDistance()) {
          // The priority queue does not like when the ordering of its elements is changed, so
          // when we change the minimum distance of any vertex, we need to remove it and re-insert
          // it into the set.
          vertexQueue.remove(v);
          v.setMinDistance(distanceThroughU);
          v.setPrevious(u);
          vertexQueue.add(v);
        }
      }

      // Visit each TRANSFER edge exiting u
      for (Edge edge : u.getTransferEdges()) {
        Station v = edge.getTarget();
        double weight = edge.getWeight();

        // relax the edge (u, v) :
        // if (u, v) is an edge and u is on the shortest path to v, then d(u) + w(u,v) = d(v).
        double distanceThroughU = u.getMinDistance() + weight;

        if (distanceThroughU < v.getMinDistance()) {
          // The priority queue does not like when the ordering of its elements is changed, so
          // when we change the minimum distance of any vertex, we need to remove it and re-insert
          // it into the set.
          vertexQueue.remove(v);
          v.setMinDistance(distanceThroughU);
          v.setPrevious(u);
          vertexQueue.add(v);
        }
      }

      // // Visit each edge exiting u
      // List<Edge> neighborEdges = u.getNeighborEdges();
      // List<Edge> transferEdges = u.getTransferEdges();
      // List<Edge> allEdges = new ArrayList<Edge>();
      // allEdges.addAll(neighborEdges);
      // allEdges.addAll(transferEdges);
      // System.out.println("allEdges: " + allEdges.size());
      // for (Edge edge : allEdges) {
      // Station v = edge.getTarget();
      // double weight = edge.getWeight();
      //
      // // relax the edge (u, v) :
      // // if (u, v) is an edge and u is on the shortest path to v, then d(u) + w(u,v) = d(v).
      // double distanceThroughU = u.getMinDistance() + weight;
      //
      // if (distanceThroughU < v.getMinDistance()) {
      // // The priority queue does not like when the ordering of its elements is changed, so
      // // when we change the minimum distance of any vertex, we need to remove it and re-insert
      // // it into the set.
      // vertexQueue.remove(v);
      // v.setMinDistance(distanceThroughU);
      // v.setPrevious(u);
      // vertexQueue.add(v);
      // }
      // }

    }
  }