This document provides the foundations behind the functionality provided by the \(\rho\)G library (https://github.com/santiontanon/RHOG), focusing on the basic operations the library provides: subsumption, refinement of directed labeled graphs, and distance/similarity assessment between directed labeled graphs. \(\rho\)G development was initially supported by the National Science Foundation, by the EAGER grant IIS-1551338.