Given an unweighted undirected graph as an adjacency list, and a source vertex, return an array where `dist[i]` is the **shortest distance** (number of edges) from the source to vertex i. Unreachable vertices should have distance **-1**.
Interactive graph explorer available!
Switch to the Visualize tab to build a custom graph and animate BFS traversal to test your intuition.