public static <N> void merge(MutableGraph<N> graph1, Graph<N> graph2) {
        for (N node : graph2.nodes()) {
            graph1.addNode(node);
        }
        for (EndpointPair<N> edge : graph2.edges()) {
            graph1.putEdge(edge.nodeU(), edge.nodeV());
        }
    }
@Test
    public void mergeDistinctGraphs() {
        final MutableGraph<String> graph1 = GraphBuilder.directed().build();
        graph1.addNode("Test1");
        graph1.addNode("Test2");
        graph1.putEdge("Test1", "Test2");

        final MutableGraph<String> graph2 = GraphBuilder.directed().build();
        graph2.addNode("Test3");
        graph2.addNode("Test4");
        graph2.putEdge("Test3", "Test4");

        final MutableGraph<String> expectedGraph = GraphBuilder.directed().build();
        expectedGraph.addNode("Test1");
        expectedGraph.addNode("Test2");
        expectedGraph.addNode("Test3");
        expectedGraph.addNode("Test4");
        expectedGraph.putEdge("Test1", "Test2");
        expectedGraph.putEdge("Test3", "Test4");

        Graphs.merge(graph1, graph2);
        assertThat(graph1).isEqualTo(expectedGraph);
    }