add some utility functions for graphs