Matrix Graph Grammars: An Algebraic Approach to Graph Dynamics