/** . */ public void testDirectedGraph() { ListenableDirectedGraph<String, DefaultEdge> g = new ListenableDirectedGraph<String, DefaultEdge>(DefaultEdge.class); g.addVertex(V1); g.addVertex(V2); g.addVertex(V3); g.addEdge(V1, V2); ConnectivityInspector<String, DefaultEdge> inspector = new ConnectivityInspector<String, DefaultEdge>(g); g.addGraphListener(inspector); assertEquals(false, inspector.isGraphConnected()); g.addEdge(V1, V3); assertEquals(true, inspector.isGraphConnected()); }
/** . */ public void testIsGraphConnected() { Pseudograph<String, DefaultEdge> g = create(); ConnectivityInspector<String, DefaultEdge> inspector = new ConnectivityInspector<String, DefaultEdge>(g); assertEquals(false, inspector.isGraphConnected()); g.removeVertex(V4); inspector = new ConnectivityInspector<String, DefaultEdge>(g); assertEquals(true, inspector.isGraphConnected()); g.removeVertex(V1); assertEquals(1, g.edgeSet().size()); g.removeEdge(e2); g.addEdge(V2, V2); assertEquals(1, g.edgeSet().size()); inspector = new ConnectivityInspector<String, DefaultEdge>(g); assertEquals(false, inspector.isGraphConnected()); }