Graphs and breadth-first traversal