refine the graph.