Add method to merge graphs.