Adds a graph union function.