:
C++
Unweighted graphs use
vector<vector<int>> adj; weighted ones use vector<vector<pair<int,int>>> adj where adj[u] holds {v, w}. The animations visit neighbors in ascending order.