add some utility functions in GraphUtil.