  We present the algebraic representation and basic algorithms for MultiAspect
Graphs (MAGs). A MAG is a structure capable of representing multilayer and
time-varying networks, as well as higher-order networks, while also having the
property of being isomorphic to a directed graph. In particular, we show that,
as a consequence of the properties associated with the MAG structure, a MAG can
be represented in matrix form. Moreover, we also show that any possible MAG
function (algorithm) can be obtained from this matrix-based representation.
This is an important theoretical result since it paves the way for adapting
well-known graph algorithms for application in MAGs. We present a set of basic
MAG algorithms, constructed from well-known graph algorithms, such as degree
computing, Breadth First Search (BFS), and Depth First Search (DFS). These
algorithms adapted to the MAG context can be used as primitives for building
other more sophisticated MAG algorithms. Therefore, such examples can be seen
as guidelines on how to properly derive MAG algorithms from basic algorithms on
directed graph. We also make available Python implementations of all the
algorithms presented in this paper.
