I asked a question regarding modular arithmetic in CS StackExchange website but think that there are critical mistakes in the modular arithmetic. The following is the link to the question https://cs.stackexchange.com/questions/129527/shortest-path-in-modular-arithmetic/129538#129538.
For the original question, we can reinterpret: x and y connects iff $x + a ≡ y$ mod $n$. The answer rewrite the above congruence $x - y ≡ a$ mod $n$. If we apply addition modular arithmetic, we should get $x - y ≡ -a$ mod $n$. Also, if the above conversion is correct, how does the answer get $x + ma ≡ y$ mod $n$ from $x - y ≡ a$ mod $n$. If both operations are incorrect, how can we play with modular arithmetic to solve this problem?