If we want to detect and odd cycle if an undirected graph $G=<V,E>$. Suppose we run BFS algorithm from CLRS book as follows,
Q: Now my question is suppose we have the following graphs:
The figure to the left above:
- $d[v] \bmod{2} == d[u] \bmod{2}$ equal and gives odd cycle.
- $d[v] \bmod{2} == d[a] \bmod{2}$ not equal remainder, so won't give odd cycle.
The figure to the right above:
- $d[x] \bmod{2} == d[u] \bmod{2}$ not equal remainder, so won't give odd cycle.
- $d[x] \bmod{2} == d[v] \bmod{2}$ not equal remainder, so won't give odd cycle.
Problem: so the only case to discover odd cycle is when we have the left right graph and when exactly we compare vertex $v$ distance with $u$ distance. What do you think please? If the mod operator works, can you give your interpretation as why this should work in general please if possible?

