add graph for tree