What is the time complexity of BFS on an adjacency list?

What is the time complexity of BFS on an adjacency list?

Approach: Analyze visits to each vertex and edge.

O(V + E). Every vertex is enqueued and dequeued once, and every edge is checked exactly once (or twice in an undirected graph).

Follow-up: What is the complexity if using an adjacency matrix?

Key concepts: O(V + E), vertex visit, edge traversal.