updating data strctures to merge the partial graphs