Exemplo n.º 1
0
 public void testDirectedConnectIfNotFound(Graph<String, String> graph) {
   graph.createNode("a");
   graph.createNode("b");
   graph.connectIfNotFound("a", "-", "b");
   assertEquals(1, graph.getNodeDegree("a"));
   graph.connectIfNotFound("a", "-", "b");
   assertEquals(1, graph.getNodeDegree("a"));
   graph.connectIfNotFound("a", null, "b");
   assertEquals(2, graph.getNodeDegree("a"));
   graph.connectIfNotFound("a", null, "b");
   assertEquals(2, graph.getNodeDegree("a"));
 }
Exemplo n.º 2
0
 public void testDirectedDegree(Graph<String, String> graph) {
   graph.createNode("a");
   graph.createNode("b");
   graph.createNode("c");
   graph.createNode("d");
   assertEquals(0, graph.getNodeDegree("a"));
   graph.connect("a", "-", "b");
   assertEquals(1, graph.getNodeDegree("a"));
   graph.connect("b", "-", "c");
   assertEquals(1, graph.getNodeDegree("a"));
   graph.connect("a", "-", "c");
   assertEquals(2, graph.getNodeDegree("a"));
   graph.connect("d", "-", "a");
   assertEquals(3, graph.getNodeDegree("a"));
 }