revise BFS, connected component algorithms to use vertex(v, g) instead of vertex(v)