Modify graph 1 in-place to create graph 2