Traverse the graph starting from node A using BFS.
BFS: Visit neighbors level by level, using a queue.