コード例 #1
0
 @Test
 public void testNbrOfVerticesTwoVertices() {
   Graph<String, Integer> g = new DiGraph<String, Integer>();
   g.addVertex("a");
   g.addVertex("b");
   assertEquals(2, GraphUtilities.nbrOfVertices(g));
 }
コード例 #2
0
 @Test
 public void testNbrOfVerticesFiveVertices() {
   Graph<String, Integer> g = new DiGraph<String, Integer>();
   Graph.Vertex<String, Integer> v1 = g.addVertex("a");
   Graph.Vertex<String, Integer> v2 = g.addVertex("b");
   Graph.Vertex<String, Integer> v3 = g.addVertex("c");
   Graph.Vertex<String, Integer> v4 = g.addVertex("d");
   Graph.Vertex<String, Integer> v5 = g.addVertex("e");
   g.addEdge(1, v1, v2);
   g.addEdge(4, v2, v3);
   g.addEdge(3, v3, v4);
   g.addEdge(7, v4, v5);
   g.addEdge(2, v5, v1);
   assertEquals(5, GraphUtilities.nbrOfVertices(g));
 }
コード例 #3
0
 @Test
 public void testNbrOfVerticesNoVertices() {
   Graph<String, Integer> g = new DiGraph<String, Integer>();
   assertEquals(0, GraphUtilities.nbrOfVertices(g));
 }