4. For any $x, y \in R$, the minimum value of the algebraic expression $M=\sqrt{2 x^{2}-6 x+5}+\sqrt{y^{2}-4 y+5}+\sqrt{2 x^{2}-2 x y+y^{2}}$ is

保留源文本的换行和格式，直接输出翻译结果如下：

4. For any $x, y \in R$, the algebraic expression $M=\sqrt{2 x^{2}-6 x+5}+\sqrt{y^{2}-4 y+5}+\sqrt{2 x^{2}-2 x y+y^{2}}$ has a minimum value of
4. $\sqrt{10}$

Analysis: Completing the square gives $M=\sqrt{(x-1)^{2}+(x-2)^{2}}+\sqrt{1+(y-2)^{2}}+\sqrt{x^{2}+(x-y)^{2}}$, let $A(1,2), B(x, x), C(0, y)$, the symmetric point of point $A$ about the line $y=x$ is $A_{1}(2,1)$, and the symmetric point about the $y$-axis is $A_{2}(-1,2)$, so: $M=|A B|+|A C|+|B C|=\left|A_{1} B\right|+\left|A_{2} C\right|+|B C| \geqslant\left|A_{1} A_{2}\right|=\sqrt{10}$