4.14.2006

Adjacency Matrix in LaTeX

Here is some LaTeX markup to write an Adjancency Matrix.


\begin{math}
\begin{array}{cc}
&
\begin{array}{ccccccc}
A & B & C & D & E & F & G
\end{array}
\ \begin{array}{c}
A \\ B \\ C \\ D \\ E \\ F \\ G
\end{array}
&
\left[
\begin{array}{ccccccc}
0 \; & 1 \; & 0 \; & 0 \; & 0 \; & 0 \; & 0 \
0 \; & 0 \; & 1 \; & 0 \; & 0 \; & 1 \; & 0 \
0 \; & 0 \; & 0 \; & 1 \; & 0 \; & 0 \; & 0 \
0 \; & 0 \; & 0 \; & 0 \; & 1 \; & 0 \; & 0 \
0 \; & 0 \; & 0 \; & 0 \; & 0 \; & 1 \; & 0 \
0 \; & 0 \; & 0 \; & 0 \; & 0 \; & 0 \; & 1 \
1 \; & 0 \; & 1 \; & 0 \; & 1 \; & 0 \; & 0
\end{array}
\right]
\end{array}
\end{math}


On a mathematical note. You can use the Adjacency Matrix to find the number of paths of length n between two nodes when you calculate An.