deconstruction function of graph