/** * 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); }
public static void main(String[] args) { if (args.length == 0) { System.out.println(USAGE); return; } File file = new File(args[0]); if (!file.exists()) { System.out.println("Unable to locate file: " + args[0] + NEWLINE + USAGE); return; } try { AllPairsShortestPath program = new AllPairsShortestPath(file); program.solve(); program.showMenu(); } catch (Exception e) { System.out.println("Error occured"); } }
public float[][] getAPSDistancesArr() { return allPairsShortestPath.getDistancesArr(); }
public HashMap<Node, HashMap<Node, Float>> getAPSDistances() { return allPairsShortestPath.getDistances(); }