// CSE 373, Winter 2013, Marty Stepp // This program demonstrates some usage of the SearchableGraph class. // It creates a graph that represents the "flights between cities" graph // shown in the lecture slides and then prints information about the graph's // vertices (cities), edges (flights), and paths. // You must attach Graph.jar and Guava's JAR to your project for it to compile // and run properly. import java.util.*; public class Flights { public static void main(String[] args) { Graph graph = new SearchableGraph(false, true); printLots(graph); System.out.println("adding vertices (airports) ..."); graph.addVertex("DFW"); graph.addVertex("HNL"); graph.addVertex("LAX"); graph.addVertex("LGA"); graph.addVertex("MIA"); graph.addVertex("ORD"); graph.addVertex("PVD"); graph.addVertex("SFO"); printLots(graph); System.out.println("adding edges (flights) ..."); graph.addEdge("DFW", "LAX", "flight01", 120); graph.addEdge("DFW", "LGA", "flight02", 140); graph.addEdge("DFW", "MIA", "flight03", 110); graph.addEdge("DFW", "ORD", "flight04", 80); graph.addEdge("HNL", "LAX", "flight05", 250); graph.addEdge("HNL", "MIA", "flight06", 500); graph.addEdge("HNL", "SFO", "flight07", 130); graph.addEdge("LAX", "SFO", "flight08", 60); graph.addEdge("LAX", "ORD", "flight09", 170); graph.addEdge("LGA", "MIA", "flight10", 100); graph.addEdge("LGA", "PVD", "flight11", 200); graph.addEdge("ORD", "PVD", "flight12", 50); graph.addEdge("ORD", "SFO", "flight13", 70); printLots(graph); System.out.println("removing a few vertices ..."); graph.removeVertex("ORD"); // this should remove edges: flight04,09,12,13 graph.removeVertex("PVD"); // this should remove edges: flight11 printLots(graph); System.out.println("removing a few edges ..."); graph.removeEdge("LGA", "DFW"); // flight02 graph.removeEdge("flight05"); // "HNL","LAX" printLots(graph); } // Prints out a lot of information about the given graph, // such as all vertices, all edges, and all paths found. public static void printLots(Graph graph) { System.out.println("graph:"); System.out.println(" toString=" + graph); System.out.println(" directed=" + graph.isDirected() + ", weighted=" + graph.isWeighted() + ", isEmpty=" + graph.isEmpty()); System.out.println("vertices=" + graph.vertices() + ", vertexCount=" + graph.vertexCount()); for (V v : graph.vertices()) { System.out.println(" vertex " + v + ": degree=" + graph.degree(v) + ", inDegree=" + graph.inDegree(v) + ", outDegree=" + graph.outDegree(v) + ", containsVertex(" + v + ")=" + graph.containsVertex(v) + ", neighbors=" + graph.neighbors(v)); } System.out.println("edges=" + graph.edges() + ", edgeCount=" + graph.edgeCount()); for (E e : graph.edges()) { System.out.println(" edge " + e + ": containsEdge(" + e + ")=" + graph.containsEdge(e)); } System.out.println("paths:"); for (V v1 : graph.vertices()) { for (V v2 : graph.vertices()) { List min = graph.minimumWeightPath(v1, v2); System.out.println(" (" + v1 + "," + v2 + ") isReachable=" + graph.isReachable(v1, v2) + ", shortest=" + graph.shortestPath(v1, v2) + ", minWeight=" + min + (min == null ? "" : " (cost=" + graph.cost(min) + ")")); } } System.out.println(); } } /* output: graph: toString={V={}, E={}} directed=false, weighted=true, isEmpty=true vertices=[], vertexCount=0 edges=[], edgeCount=0 paths: adding vertices (airports) ... graph: toString={V={MIA, LAX, DFW, HNL, ORD, LGA, SFO, PVD}, E={}} directed=false, weighted=true, isEmpty=false vertices=[MIA, LAX, DFW, HNL, ORD, LGA, SFO, PVD], vertexCount=8 vertex MIA: degree=0, inDegree=0, outDegree=0, containsVertex(MIA)=true, neighbors=[] vertex LAX: degree=0, inDegree=0, outDegree=0, containsVertex(LAX)=true, neighbors=[] vertex DFW: degree=0, inDegree=0, outDegree=0, containsVertex(DFW)=true, neighbors=[] vertex HNL: degree=0, inDegree=0, outDegree=0, containsVertex(HNL)=true, neighbors=[] vertex ORD: degree=0, inDegree=0, outDegree=0, containsVertex(ORD)=true, neighbors=[] vertex LGA: degree=0, inDegree=0, outDegree=0, containsVertex(LGA)=true, neighbors=[] vertex SFO: degree=0, inDegree=0, outDegree=0, containsVertex(SFO)=true, neighbors=[] vertex PVD: degree=0, inDegree=0, outDegree=0, containsVertex(PVD)=true, neighbors=[] edges=[], edgeCount=0 paths: (MIA,MIA) isReachable=true, shortest=[MIA], minWeight=[MIA] (cost=0) (MIA,LAX) isReachable=false, shortest=null, minWeight=null (MIA,DFW) isReachable=false, shortest=null, minWeight=null (MIA,HNL) isReachable=false, shortest=null, minWeight=null (MIA,ORD) isReachable=false, shortest=null, minWeight=null (MIA,LGA) isReachable=false, shortest=null, minWeight=null (MIA,SFO) isReachable=false, shortest=null, minWeight=null (MIA,PVD) isReachable=false, shortest=null, minWeight=null (LAX,MIA) isReachable=false, shortest=null, minWeight=null (LAX,LAX) isReachable=true, shortest=[LAX], minWeight=[LAX] (cost=0) (LAX,DFW) isReachable=false, shortest=null, minWeight=null (LAX,HNL) isReachable=false, shortest=null, minWeight=null (LAX,ORD) isReachable=false, shortest=null, minWeight=null (LAX,LGA) isReachable=false, shortest=null, minWeight=null (LAX,SFO) isReachable=false, shortest=null, minWeight=null (LAX,PVD) isReachable=false, shortest=null, minWeight=null (DFW,MIA) isReachable=false, shortest=null, minWeight=null (DFW,LAX) isReachable=false, shortest=null, minWeight=null (DFW,DFW) isReachable=true, shortest=[DFW], minWeight=[DFW] (cost=0) (DFW,HNL) isReachable=false, shortest=null, minWeight=null (DFW,ORD) isReachable=false, shortest=null, minWeight=null (DFW,LGA) isReachable=false, shortest=null, minWeight=null (DFW,SFO) isReachable=false, shortest=null, minWeight=null (DFW,PVD) isReachable=false, shortest=null, minWeight=null (HNL,MIA) isReachable=false, shortest=null, minWeight=null (HNL,LAX) isReachable=false, shortest=null, minWeight=null (HNL,DFW) isReachable=false, shortest=null, minWeight=null (HNL,HNL) isReachable=true, shortest=[HNL], minWeight=[HNL] (cost=0) (HNL,ORD) isReachable=false, shortest=null, minWeight=null (HNL,LGA) isReachable=false, shortest=null, minWeight=null (HNL,SFO) isReachable=false, shortest=null, minWeight=null (HNL,PVD) isReachable=false, shortest=null, minWeight=null (ORD,MIA) isReachable=false, shortest=null, minWeight=null (ORD,LAX) isReachable=false, shortest=null, minWeight=null (ORD,DFW) isReachable=false, shortest=null, minWeight=null (ORD,HNL) isReachable=false, shortest=null, minWeight=null (ORD,ORD) isReachable=true, shortest=[ORD], minWeight=[ORD] (cost=0) (ORD,LGA) isReachable=false, shortest=null, minWeight=null (ORD,SFO) isReachable=false, shortest=null, minWeight=null (ORD,PVD) isReachable=false, shortest=null, minWeight=null (LGA,MIA) isReachable=false, shortest=null, minWeight=null (LGA,LAX) isReachable=false, shortest=null, minWeight=null (LGA,DFW) isReachable=false, shortest=null, minWeight=null (LGA,HNL) isReachable=false, shortest=null, minWeight=null (LGA,ORD) isReachable=false, shortest=null, minWeight=null (LGA,LGA) isReachable=true, shortest=[LGA], minWeight=[LGA] (cost=0) (LGA,SFO) isReachable=false, shortest=null, minWeight=null (LGA,PVD) isReachable=false, shortest=null, minWeight=null (SFO,MIA) isReachable=false, shortest=null, minWeight=null (SFO,LAX) isReachable=false, shortest=null, minWeight=null (SFO,DFW) isReachable=false, shortest=null, minWeight=null (SFO,HNL) isReachable=false, shortest=null, minWeight=null (SFO,ORD) isReachable=false, shortest=null, minWeight=null (SFO,LGA) isReachable=false, shortest=null, minWeight=null (SFO,SFO) isReachable=true, shortest=[SFO], minWeight=[SFO] (cost=0) (SFO,PVD) isReachable=false, shortest=null, minWeight=null (PVD,MIA) isReachable=false, shortest=null, minWeight=null (PVD,LAX) isReachable=false, shortest=null, minWeight=null (PVD,DFW) isReachable=false, shortest=null, minWeight=null (PVD,HNL) isReachable=false, shortest=null, minWeight=null (PVD,ORD) isReachable=false, shortest=null, minWeight=null (PVD,LGA) isReachable=false, shortest=null, minWeight=null (PVD,SFO) isReachable=false, shortest=null, minWeight=null (PVD,PVD) isReachable=true, shortest=[PVD], minWeight=[PVD] (cost=0) adding edges (flights) ... graph: toString={V={MIA, LAX, DFW, HNL, ORD, LGA, SFO, PVD}, E={(DFW,MIA,flight03,weight=110), (HNL,MIA,flight06,weight=500), (LGA,MIA,flight10,weight=100), (LAX,ORD,flight09,weight=170), (LAX,SFO,flight08,weight=60), (DFW,LAX,flight01,weight=120), (HNL,LAX,flight05,weight=250), (DFW,MIA,flight03,weight=110), (DFW,ORD,flight04,weight=80), (DFW,LAX,flight01,weight=120), (DFW,LGA,flight02,weight=140), (HNL,SFO,flight07,weight=130), (HNL,MIA,flight06,weight=500), (HNL,LAX,flight05,weight=250), (ORD,SFO,flight13,weight=70), (DFW,ORD,flight04,weight=80), (ORD,PVD,flight12,weight=50), (LAX,ORD,flight09,weight=170), (LGA,MIA,flight10,weight=100), (DFW,LGA,flight02,weight=140), (LGA,PVD,flight11,weight=200), (ORD,SFO,flight13,weight=70), (HNL,SFO,flight07,weight=130), (LAX,SFO,flight08,weight=60), (ORD,PVD,flight12,weight=50), (LGA,PVD,flight11,weight=200)}} directed=false, weighted=true, isEmpty=false vertices=[MIA, LAX, DFW, HNL, ORD, LGA, SFO, PVD], vertexCount=8 vertex MIA: degree=3, inDegree=3, outDegree=3, containsVertex(MIA)=true, neighbors=[DFW, HNL, LGA] vertex LAX: degree=4, inDegree=4, outDegree=4, containsVertex(LAX)=true, neighbors=[ORD, SFO, DFW, HNL] vertex DFW: degree=4, inDegree=4, outDegree=4, containsVertex(DFW)=true, neighbors=[MIA, ORD, LAX, LGA] vertex HNL: degree=3, inDegree=3, outDegree=3, containsVertex(HNL)=true, neighbors=[SFO, MIA, LAX] vertex ORD: degree=4, inDegree=4, outDegree=4, containsVertex(ORD)=true, neighbors=[SFO, DFW, PVD, LAX] vertex LGA: degree=3, inDegree=3, outDegree=3, containsVertex(LGA)=true, neighbors=[MIA, DFW, PVD] vertex SFO: degree=3, inDegree=3, outDegree=3, containsVertex(SFO)=true, neighbors=[ORD, HNL, LAX] vertex PVD: degree=2, inDegree=2, outDegree=2, containsVertex(PVD)=true, neighbors=[ORD, LGA] edges=[flight01, flight02, flight03, flight04, flight05, flight06, flight07, flight08, flight09, flight10, flight11, flight12, flight13], edgeCount=13 edge flight01: containsEdge(flight01)=true edge flight02: containsEdge(flight02)=true edge flight03: containsEdge(flight03)=true edge flight04: containsEdge(flight04)=true edge flight05: containsEdge(flight05)=true edge flight06: containsEdge(flight06)=true edge flight07: containsEdge(flight07)=true edge flight08: containsEdge(flight08)=true edge flight09: containsEdge(flight09)=true edge flight10: containsEdge(flight10)=true edge flight11: containsEdge(flight11)=true edge flight12: containsEdge(flight12)=true edge flight13: containsEdge(flight13)=true paths: (MIA,MIA) isReachable=true, shortest=[MIA], minWeight=[MIA] (cost=0) (MIA,LAX) isReachable=true, shortest=[MIA, DFW, LAX], minWeight=[MIA, DFW, LAX] (cost=230) (MIA,DFW) isReachable=true, shortest=[MIA, DFW], minWeight=[MIA, DFW] (cost=110) (MIA,HNL) isReachable=true, shortest=[MIA, HNL], minWeight=[MIA, DFW, ORD, SFO, HNL] (cost=390) (MIA,ORD) isReachable=true, shortest=[MIA, DFW, ORD], minWeight=[MIA, DFW, ORD] (cost=190) (MIA,LGA) isReachable=true, shortest=[MIA, LGA], minWeight=[MIA, LGA] (cost=100) (MIA,SFO) isReachable=true, shortest=[MIA, HNL, SFO], minWeight=[MIA, DFW, ORD, SFO] (cost=260) (MIA,PVD) isReachable=true, shortest=[MIA, LGA, PVD], minWeight=[MIA, DFW, ORD, PVD] (cost=240) (LAX,MIA) isReachable=true, shortest=[LAX, DFW, MIA], minWeight=[LAX, DFW, MIA] (cost=230) (LAX,LAX) isReachable=true, shortest=[LAX], minWeight=[LAX] (cost=0) (LAX,DFW) isReachable=true, shortest=[LAX, DFW], minWeight=[LAX, DFW] (cost=120) (LAX,HNL) isReachable=true, shortest=[LAX, HNL], minWeight=[LAX, SFO, HNL] (cost=190) (LAX,ORD) isReachable=true, shortest=[LAX, ORD], minWeight=[LAX, SFO, ORD] (cost=130) (LAX,LGA) isReachable=true, shortest=[LAX, DFW, LGA], minWeight=[LAX, DFW, LGA] (cost=260) (LAX,SFO) isReachable=true, shortest=[LAX, SFO], minWeight=[LAX, SFO] (cost=60) (LAX,PVD) isReachable=true, shortest=[LAX, ORD, PVD], minWeight=[LAX, SFO, ORD, PVD] (cost=180) (DFW,MIA) isReachable=true, shortest=[DFW, MIA], minWeight=[DFW, MIA] (cost=110) (DFW,LAX) isReachable=true, shortest=[DFW, LAX], minWeight=[DFW, LAX] (cost=120) (DFW,DFW) isReachable=true, shortest=[DFW], minWeight=[DFW] (cost=0) (DFW,HNL) isReachable=true, shortest=[DFW, MIA, HNL], minWeight=[DFW, ORD, SFO, HNL] (cost=280) (DFW,ORD) isReachable=true, shortest=[DFW, ORD], minWeight=[DFW, ORD] (cost=80) (DFW,LGA) isReachable=true, shortest=[DFW, LGA], minWeight=[DFW, LGA] (cost=140) (DFW,SFO) isReachable=true, shortest=[DFW, ORD, SFO], minWeight=[DFW, ORD, SFO] (cost=150) (DFW,PVD) isReachable=true, shortest=[DFW, ORD, PVD], minWeight=[DFW, ORD, PVD] (cost=130) (HNL,MIA) isReachable=true, shortest=[HNL, MIA], minWeight=[HNL, SFO, ORD, DFW, MIA] (cost=390) (HNL,LAX) isReachable=true, shortest=[HNL, LAX], minWeight=[HNL, SFO, LAX] (cost=190) (HNL,DFW) isReachable=true, shortest=[HNL, MIA, DFW], minWeight=[HNL, SFO, ORD, DFW] (cost=280) (HNL,HNL) isReachable=true, shortest=[HNL], minWeight=[HNL] (cost=0) (HNL,ORD) isReachable=true, shortest=[HNL, SFO, ORD], minWeight=[HNL, SFO, ORD] (cost=200) (HNL,LGA) isReachable=true, shortest=[HNL, MIA, LGA], minWeight=[HNL, SFO, ORD, DFW, LGA] (cost=420) (HNL,SFO) isReachable=true, shortest=[HNL, SFO], minWeight=[HNL, SFO] (cost=130) (HNL,PVD) isReachable=true, shortest=[HNL, SFO, ORD, PVD], minWeight=[HNL, SFO, ORD, PVD] (cost=250) (ORD,MIA) isReachable=true, shortest=[ORD, DFW, MIA], minWeight=[ORD, DFW, MIA] (cost=190) (ORD,LAX) isReachable=true, shortest=[ORD, LAX], minWeight=[ORD, SFO, LAX] (cost=130) (ORD,DFW) isReachable=true, shortest=[ORD, DFW], minWeight=[ORD, DFW] (cost=80) (ORD,HNL) isReachable=true, shortest=[ORD, SFO, HNL], minWeight=[ORD, SFO, HNL] (cost=200) (ORD,ORD) isReachable=true, shortest=[ORD], minWeight=[ORD] (cost=0) (ORD,LGA) isReachable=true, shortest=[ORD, DFW, LGA], minWeight=[ORD, DFW, LGA] (cost=220) (ORD,SFO) isReachable=true, shortest=[ORD, SFO], minWeight=[ORD, SFO] (cost=70) (ORD,PVD) isReachable=true, shortest=[ORD, PVD], minWeight=[ORD, PVD] (cost=50) (LGA,MIA) isReachable=true, shortest=[LGA, MIA], minWeight=[LGA, MIA] (cost=100) (LGA,LAX) isReachable=true, shortest=[LGA, DFW, LAX], minWeight=[LGA, DFW, LAX] (cost=260) (LGA,DFW) isReachable=true, shortest=[LGA, DFW], minWeight=[LGA, DFW] (cost=140) (LGA,HNL) isReachable=true, shortest=[LGA, MIA, HNL], minWeight=[LGA, DFW, ORD, SFO, HNL] (cost=420) (LGA,ORD) isReachable=true, shortest=[LGA, DFW, ORD], minWeight=[LGA, DFW, ORD] (cost=220) (LGA,LGA) isReachable=true, shortest=[LGA], minWeight=[LGA] (cost=0) (LGA,SFO) isReachable=true, shortest=[LGA, MIA, HNL, SFO], minWeight=[LGA, DFW, ORD, SFO] (cost=290) (LGA,PVD) isReachable=true, shortest=[LGA, PVD], minWeight=[LGA, PVD] (cost=200) (SFO,MIA) isReachable=true, shortest=[SFO, HNL, MIA], minWeight=[SFO, ORD, DFW, MIA] (cost=260) (SFO,LAX) isReachable=true, shortest=[SFO, LAX], minWeight=[SFO, LAX] (cost=60) (SFO,DFW) isReachable=true, shortest=[SFO, ORD, DFW], minWeight=[SFO, ORD, DFW] (cost=150) (SFO,HNL) isReachable=true, shortest=[SFO, HNL], minWeight=[SFO, HNL] (cost=130) (SFO,ORD) isReachable=true, shortest=[SFO, ORD], minWeight=[SFO, ORD] (cost=70) (SFO,LGA) isReachable=true, shortest=[SFO, ORD, DFW, LGA], minWeight=[SFO, ORD, DFW, LGA] (cost=290) (SFO,SFO) isReachable=true, shortest=[SFO], minWeight=[SFO] (cost=0) (SFO,PVD) isReachable=true, shortest=[SFO, ORD, PVD], minWeight=[SFO, ORD, PVD] (cost=120) (PVD,MIA) isReachable=true, shortest=[PVD, LGA, MIA], minWeight=[PVD, ORD, DFW, MIA] (cost=240) (PVD,LAX) isReachable=true, shortest=[PVD, ORD, LAX], minWeight=[PVD, ORD, SFO, LAX] (cost=180) (PVD,DFW) isReachable=true, shortest=[PVD, ORD, DFW], minWeight=[PVD, ORD, DFW] (cost=130) (PVD,HNL) isReachable=true, shortest=[PVD, ORD, SFO, HNL], minWeight=[PVD, ORD, SFO, HNL] (cost=250) (PVD,ORD) isReachable=true, shortest=[PVD, ORD], minWeight=[PVD, ORD] (cost=50) (PVD,LGA) isReachable=true, shortest=[PVD, LGA], minWeight=[PVD, LGA] (cost=200) (PVD,SFO) isReachable=true, shortest=[PVD, ORD, SFO], minWeight=[PVD, ORD, SFO] (cost=120) (PVD,PVD) isReachable=true, shortest=[PVD], minWeight=[PVD] (cost=0) removing a few vertices ... graph: toString={V={MIA, LAX, DFW, HNL, LGA, SFO}, E={(DFW,MIA,flight03,weight=110), (HNL,MIA,flight06,weight=500), (LGA,MIA,flight10,weight=100), (LAX,SFO,flight08,weight=60), (DFW,LAX,flight01,weight=120), (HNL,LAX,flight05,weight=250), (DFW,MIA,flight03,weight=110), (DFW,LAX,flight01,weight=120), (DFW,LGA,flight02,weight=140), (HNL,SFO,flight07,weight=130), (HNL,MIA,flight06,weight=500), (HNL,LAX,flight05,weight=250), (LGA,MIA,flight10,weight=100), (DFW,LGA,flight02,weight=140), (HNL,SFO,flight07,weight=130), (LAX,SFO,flight08,weight=60)}} directed=false, weighted=true, isEmpty=false vertices=[MIA, LAX, DFW, HNL, LGA, SFO], vertexCount=6 vertex MIA: degree=3, inDegree=3, outDegree=3, containsVertex(MIA)=true, neighbors=[DFW, HNL, LGA] vertex LAX: degree=3, inDegree=3, outDegree=3, containsVertex(LAX)=true, neighbors=[SFO, DFW, HNL] vertex DFW: degree=3, inDegree=3, outDegree=3, containsVertex(DFW)=true, neighbors=[MIA, LAX, LGA] vertex HNL: degree=3, inDegree=3, outDegree=3, containsVertex(HNL)=true, neighbors=[SFO, MIA, LAX] vertex LGA: degree=2, inDegree=2, outDegree=2, containsVertex(LGA)=true, neighbors=[MIA, DFW] vertex SFO: degree=2, inDegree=2, outDegree=2, containsVertex(SFO)=true, neighbors=[HNL, LAX] edges=[flight01, flight02, flight03, flight05, flight06, flight07, flight08, flight10], edgeCount=8 edge flight01: containsEdge(flight01)=true edge flight02: containsEdge(flight02)=true edge flight03: containsEdge(flight03)=true edge flight05: containsEdge(flight05)=true edge flight06: containsEdge(flight06)=true edge flight07: containsEdge(flight07)=true edge flight08: containsEdge(flight08)=true edge flight10: containsEdge(flight10)=true paths: (MIA,MIA) isReachable=true, shortest=[MIA], minWeight=[MIA] (cost=0) (MIA,LAX) isReachable=true, shortest=[MIA, DFW, LAX], minWeight=[MIA, DFW, LAX] (cost=230) (MIA,DFW) isReachable=true, shortest=[MIA, DFW], minWeight=[MIA, DFW] (cost=110) (MIA,HNL) isReachable=true, shortest=[MIA, HNL], minWeight=[MIA, DFW, LAX, SFO, HNL] (cost=420) (MIA,LGA) isReachable=true, shortest=[MIA, LGA], minWeight=[MIA, LGA] (cost=100) (MIA,SFO) isReachable=true, shortest=[MIA, HNL, SFO], minWeight=[MIA, DFW, LAX, SFO] (cost=290) (LAX,MIA) isReachable=true, shortest=[LAX, DFW, MIA], minWeight=[LAX, DFW, MIA] (cost=230) (LAX,LAX) isReachable=true, shortest=[LAX], minWeight=[LAX] (cost=0) (LAX,DFW) isReachable=true, shortest=[LAX, DFW], minWeight=[LAX, DFW] (cost=120) (LAX,HNL) isReachable=true, shortest=[LAX, HNL], minWeight=[LAX, SFO, HNL] (cost=190) (LAX,LGA) isReachable=true, shortest=[LAX, DFW, LGA], minWeight=[LAX, DFW, LGA] (cost=260) (LAX,SFO) isReachable=true, shortest=[LAX, SFO], minWeight=[LAX, SFO] (cost=60) (DFW,MIA) isReachable=true, shortest=[DFW, MIA], minWeight=[DFW, MIA] (cost=110) (DFW,LAX) isReachable=true, shortest=[DFW, LAX], minWeight=[DFW, LAX] (cost=120) (DFW,DFW) isReachable=true, shortest=[DFW], minWeight=[DFW] (cost=0) (DFW,HNL) isReachable=true, shortest=[DFW, MIA, HNL], minWeight=[DFW, LAX, SFO, HNL] (cost=310) (DFW,LGA) isReachable=true, shortest=[DFW, LGA], minWeight=[DFW, LGA] (cost=140) (DFW,SFO) isReachable=true, shortest=[DFW, LAX, SFO], minWeight=[DFW, LAX, SFO] (cost=180) (HNL,MIA) isReachable=true, shortest=[HNL, MIA], minWeight=[HNL, SFO, LAX, DFW, MIA] (cost=420) (HNL,LAX) isReachable=true, shortest=[HNL, LAX], minWeight=[HNL, SFO, LAX] (cost=190) (HNL,DFW) isReachable=true, shortest=[HNL, MIA, DFW], minWeight=[HNL, SFO, LAX, DFW] (cost=310) (HNL,HNL) isReachable=true, shortest=[HNL], minWeight=[HNL] (cost=0) (HNL,LGA) isReachable=true, shortest=[HNL, MIA, LGA], minWeight=[HNL, SFO, LAX, DFW, LGA] (cost=450) (HNL,SFO) isReachable=true, shortest=[HNL, SFO], minWeight=[HNL, SFO] (cost=130) (LGA,MIA) isReachable=true, shortest=[LGA, MIA], minWeight=[LGA, MIA] (cost=100) (LGA,LAX) isReachable=true, shortest=[LGA, DFW, LAX], minWeight=[LGA, DFW, LAX] (cost=260) (LGA,DFW) isReachable=true, shortest=[LGA, DFW], minWeight=[LGA, DFW] (cost=140) (LGA,HNL) isReachable=true, shortest=[LGA, MIA, HNL], minWeight=[LGA, DFW, LAX, SFO, HNL] (cost=450) (LGA,LGA) isReachable=true, shortest=[LGA], minWeight=[LGA] (cost=0) (LGA,SFO) isReachable=true, shortest=[LGA, MIA, HNL, SFO], minWeight=[LGA, DFW, LAX, SFO] (cost=320) (SFO,MIA) isReachable=true, shortest=[SFO, HNL, MIA], minWeight=[SFO, LAX, DFW, MIA] (cost=290) (SFO,LAX) isReachable=true, shortest=[SFO, LAX], minWeight=[SFO, LAX] (cost=60) (SFO,DFW) isReachable=true, shortest=[SFO, LAX, DFW], minWeight=[SFO, LAX, DFW] (cost=180) (SFO,HNL) isReachable=true, shortest=[SFO, HNL], minWeight=[SFO, HNL] (cost=130) (SFO,LGA) isReachable=true, shortest=[SFO, HNL, MIA, LGA], minWeight=[SFO, LAX, DFW, LGA] (cost=320) (SFO,SFO) isReachable=true, shortest=[SFO], minWeight=[SFO] (cost=0) removing a few edges ... graph: toString={V={MIA, LAX, DFW, HNL, LGA, SFO}, E={(DFW,MIA,flight03,weight=110), (HNL,MIA,flight06,weight=500), (LGA,MIA,flight10,weight=100), (LAX,SFO,flight08,weight=60), (DFW,LAX,flight01,weight=120), (DFW,MIA,flight03,weight=110), (DFW,LAX,flight01,weight=120), (HNL,SFO,flight07,weight=130), (HNL,MIA,flight06,weight=500), (LGA,MIA,flight10,weight=100), (HNL,SFO,flight07,weight=130), (LAX,SFO,flight08,weight=60)}} directed=false, weighted=true, isEmpty=false vertices=[MIA, LAX, DFW, HNL, LGA, SFO], vertexCount=6 vertex MIA: degree=3, inDegree=3, outDegree=3, containsVertex(MIA)=true, neighbors=[DFW, HNL, LGA] vertex LAX: degree=2, inDegree=2, outDegree=2, containsVertex(LAX)=true, neighbors=[SFO, DFW] vertex DFW: degree=2, inDegree=2, outDegree=2, containsVertex(DFW)=true, neighbors=[MIA, LAX] vertex HNL: degree=2, inDegree=2, outDegree=2, containsVertex(HNL)=true, neighbors=[SFO, MIA] vertex LGA: degree=1, inDegree=1, outDegree=1, containsVertex(LGA)=true, neighbors=[MIA] vertex SFO: degree=2, inDegree=2, outDegree=2, containsVertex(SFO)=true, neighbors=[HNL, LAX] edges=[flight01, flight03, flight06, flight07, flight08, flight10], edgeCount=6 edge flight01: containsEdge(flight01)=true edge flight03: containsEdge(flight03)=true edge flight06: containsEdge(flight06)=true edge flight07: containsEdge(flight07)=true edge flight08: containsEdge(flight08)=true edge flight10: containsEdge(flight10)=true paths: (MIA,MIA) isReachable=true, shortest=[MIA], minWeight=[MIA] (cost=0) (MIA,LAX) isReachable=true, shortest=[MIA, DFW, LAX], minWeight=[MIA, DFW, LAX] (cost=230) (MIA,DFW) isReachable=true, shortest=[MIA, DFW], minWeight=[MIA, DFW] (cost=110) (MIA,HNL) isReachable=true, shortest=[MIA, HNL], minWeight=[MIA, DFW, LAX, SFO, HNL] (cost=420) (MIA,LGA) isReachable=true, shortest=[MIA, LGA], minWeight=[MIA, LGA] (cost=100) (MIA,SFO) isReachable=true, shortest=[MIA, HNL, SFO], minWeight=[MIA, DFW, LAX, SFO] (cost=290) (LAX,MIA) isReachable=true, shortest=[LAX, DFW, MIA], minWeight=[LAX, DFW, MIA] (cost=230) (LAX,LAX) isReachable=true, shortest=[LAX], minWeight=[LAX] (cost=0) (LAX,DFW) isReachable=true, shortest=[LAX, DFW], minWeight=[LAX, DFW] (cost=120) (LAX,HNL) isReachable=true, shortest=[LAX, SFO, HNL], minWeight=[LAX, SFO, HNL] (cost=190) (LAX,LGA) isReachable=true, shortest=[LAX, DFW, MIA, LGA], minWeight=[LAX, DFW, MIA, LGA] (cost=330) (LAX,SFO) isReachable=true, shortest=[LAX, SFO], minWeight=[LAX, SFO] (cost=60) (DFW,MIA) isReachable=true, shortest=[DFW, MIA], minWeight=[DFW, MIA] (cost=110) (DFW,LAX) isReachable=true, shortest=[DFW, LAX], minWeight=[DFW, LAX] (cost=120) (DFW,DFW) isReachable=true, shortest=[DFW], minWeight=[DFW] (cost=0) (DFW,HNL) isReachable=true, shortest=[DFW, MIA, HNL], minWeight=[DFW, LAX, SFO, HNL] (cost=310) (DFW,LGA) isReachable=true, shortest=[DFW, MIA, LGA], minWeight=[DFW, MIA, LGA] (cost=210) (DFW,SFO) isReachable=true, shortest=[DFW, LAX, SFO], minWeight=[DFW, LAX, SFO] (cost=180) (HNL,MIA) isReachable=true, shortest=[HNL, MIA], minWeight=[HNL, SFO, LAX, DFW, MIA] (cost=420) (HNL,LAX) isReachable=true, shortest=[HNL, SFO, LAX], minWeight=[HNL, SFO, LAX] (cost=190) (HNL,DFW) isReachable=true, shortest=[HNL, MIA, DFW], minWeight=[HNL, SFO, LAX, DFW] (cost=310) (HNL,HNL) isReachable=true, shortest=[HNL], minWeight=[HNL] (cost=0) (HNL,LGA) isReachable=true, shortest=[HNL, MIA, LGA], minWeight=[HNL, SFO, LAX, DFW, MIA, LGA] (cost=520) (HNL,SFO) isReachable=true, shortest=[HNL, SFO], minWeight=[HNL, SFO] (cost=130) (LGA,MIA) isReachable=true, shortest=[LGA, MIA], minWeight=[LGA, MIA] (cost=100) (LGA,LAX) isReachable=true, shortest=[LGA, MIA, DFW, LAX], minWeight=[LGA, MIA, DFW, LAX] (cost=330) (LGA,DFW) isReachable=true, shortest=[LGA, MIA, DFW], minWeight=[LGA, MIA, DFW] (cost=210) (LGA,HNL) isReachable=true, shortest=[LGA, MIA, HNL], minWeight=[LGA, MIA, DFW, LAX, SFO, HNL] (cost=520) (LGA,LGA) isReachable=true, shortest=[LGA], minWeight=[LGA] (cost=0) (LGA,SFO) isReachable=true, shortest=[LGA, MIA, HNL, SFO], minWeight=[LGA, MIA, DFW, LAX, SFO] (cost=390) (SFO,MIA) isReachable=true, shortest=[SFO, HNL, MIA], minWeight=[SFO, LAX, DFW, MIA] (cost=290) (SFO,LAX) isReachable=true, shortest=[SFO, LAX], minWeight=[SFO, LAX] (cost=60) (SFO,DFW) isReachable=true, shortest=[SFO, LAX, DFW], minWeight=[SFO, LAX, DFW] (cost=180) (SFO,HNL) isReachable=true, shortest=[SFO, HNL], minWeight=[SFO, HNL] (cost=130) (SFO,LGA) isReachable=true, shortest=[SFO, HNL, MIA, LGA], minWeight=[SFO, LAX, DFW, MIA, LGA] (cost=390) (SFO,SFO) isReachable=true, shortest=[SFO], minWeight=[SFO] (cost=0) */