finish tree and graph