Create a matrix with self as node, cache it, return it.

        Args:
            depth (int): depth of the matrix.

        Returns:
            Matrix: an instance of Matrix.

def as_matrix(self, depth=0):
        """
        Create a matrix with self as node, cache it, return it.

        Args:
            depth (int): depth of the matrix.

        Returns:
            Matrix: an instance of Matrix.
        """
        if depth in self._matrix_cache:
            return self._matrix_cache[depth]
        self._matrix_cache[depth] = matrix = Matrix(self, depth=depth)
        return matrix