Implement the release function for graph.