%%
%% http://tex.stackexchange.com/questions/345042/how-can-i-type-this-form-of-a-matrix-in-latex
%% 　
\documentclass{jarticle}
\usepackage{rotating}
\usepackage{kbordermatrix}
\begin{document}
\[ C = \raisebox{-2\baselineskip}{%
   \begin{tabular}[b]{c@{\hspace*{0.5em}}c}
   & To node
   \\
     \begin{sideways}
       From node
     \end{sideways}
   & \raisebox{0.5\height}%
       {\(\kbordermatrix
            { &  1  &   2 &  3  &  4  &  5  \\
            1 &  1  & x_1 & x_5 &  0  &  0 \\
            2 & x_1 &  1  & x_2 & x_3 & x_4 \\
            3 & x_5 & x_2 &  1  & x_6 &  0  \\
            4 &  0  & x_3 & x_6 &  1  & x_7 \\
            5 &  0  & x_4 &  0  & x_7 & 1
            }
        \)%
       }
   \end{tabular}}
\]
\end{document}
