Amortised Analysis & the Cost of Growing
In short: most appends into a dynamic array are cheap, but one in a while the block is full and the append has to copy everything into a bigger block first. Amortised analysis proves that the expensive copies are rare enough that the average cost over any sequence of n appends is still O(1) — by adding up the whole sequence, by charging a fixed toll that banks the change, or by watching a potential function rise and fall. The same move — "bound the whole sequence, not the worst step" — also explains why your BFS's inner loop isn't the O(V²) it looks like.

In the Big-O lesson you were told that a list's rare full copy "pays for itself". Here you prove it three ways, then use the same argument where it is less obvious: your breadth-first search's neighbour loop, and a stack that shrinks as well as grows.
One operation is occasionally very expensive. Is a sequence of n operations still cheap? Amortised analysis bounds the total cost of the whole sequence and divides by n. It is not a guess about typical inputs; it holds for every sequence.
The spike, measured
Here is a dynamic array of your own, the structure behind Python's list. It keeps a
capacity and a size. An append into a spare slot costs 1 (one write). An
append into a full block first copies all size items into a block twice as big,
then writes: it costs size + 1.
Run it, then edit grow. Change it to return self.capacity + 1 and watch the
copies pile up, or to self.capacity * 3 and watch the empty slots.
Your dynamic array. Cheap appends fill spare slots, and each copy buys as many spare slots as it cost, so the bank of 3-per-append never runs dry.
Sixteen appends cost 16 writes plus 1 + 2 + 4 + 8 = 15 copies: 31, under 2 per append. The spikes are real but rare, each twice as far from the last.