Algebraic approach to 2d random geometries