  Directed mixed graphs permit directed and bidirected edges between any two
vertices. They were first considered in the path analysis developed by Sewall
Wright and play an essential role in statistical modeling. We introduce a
matrix algebra for walks on such graphs. Each element of the algebra is a
matrix whose entries are sets of walks on the graph from the corresponding row
to the corresponding column. The matrix algebra is then generated by applying
addition (set union), multiplication (concatenation), and transpose to the two
basic matrices consisting of directed and bidirected edges. We use it to
formalize, in the context of Gaussian linear systems, the correspondence
between important graphical concepts such as latent projection and graph
separation with important probabilistic concepts such as marginalization and
(conditional) independence. In two further examples regarding confounder
adjustment and the augmentation criterion, we illustrate how the algebra allows
us to visualize complex graphical proofs. A "dictionary" and LATEX macros for
the matrix algebra are provided in the Appendix.
