dag::graph_union(g1, g2) copies one graph and merges the other one into the copy before returning it. Currently the one with the larger number of vertices is selected. Investigate if selecting based on number of edges or some other criteria might be better.