Algorithms: clean-up of graph utils