add function to dump graph