@Override
 @CanIgnoreReturnValue
 final boolean addEdge(String e, Integer n1, Integer n2) {
   DirectedGraph<Integer, String> oldGraph = Graphs.copyOf(directedGraph);
   graph = directedGraph = builder.addEdge(e, n1, n2).build();
   return !graph.equals(oldGraph);
 }
 @Test
 public void addGraph_overlap() {
   DirectedGraph<Integer, String> graph = Graphs.createDirected(directedGraph.config());
   populateInputGraph(graph);
   // Add an edge that is in 'graph' (overlap)
   builder.addEdge(E12, N1, N2);
   builder.addGraph(graph);
   assertThat(builder.build()).isEqualTo(graph);
 }
 @Test
 public void addGraph_inconsistentEdges() {
   DirectedGraph<Integer, String> graph = Graphs.createDirected(directedGraph.config());
   populateInputGraph(graph);
   builder.addEdge(E21, N3, N1);
   try {
     builder.addGraph(graph);
     fail(
         "Should have rejected a graph whose edge definitions were inconsistent with existing"
             + "builder state");
   } catch (IllegalArgumentException expected) {
   }
 }