Adds a graph union function.
separated agony calculation for a graph, and that for a cluster