/** * Get the distance from one Node to another Node in the graph. * * @param from The Node to get the distance from. * @param to The Node to get the distance to. * @return The distance between two Nodes */ public double getDistance(Node from, Node to) { if (!distancesCalculated) { allPairsShortestPath = new AllPairsShortestPath(this); distancesCalculated = true; } return allPairsShortestPath.getDistance(from, to); }