R: add vertex names to BFS/DFS results