  We show that the 2-dimensional Weisfeiler-Leman algorithm stabilizes n-vertex
graphs after at most O(n log n) iterations. This implies that if such graphs
are distinguishable in 3-variable first order logic with counting, then they
can also be distinguished in this logic by a formula of quantifier depth at
most O(n log n).
  For this we exploit a new refinement based on counting walks and argue that
its iteration number differs from the classic Weisfeiler-Leman refinement by at
most a logarithmic factor. We then prove matching linear upper and lower bounds
on the number of iterations of the walk refinement. This is achieved with an
algebraic approach by exploiting properties of semisimple matrix algebras. We
also define a walk logic and a bijective walk pebble game that precisely
correspond to the new walk refinement.
