The construction of the NGM involves dividing the infectious population into several compartments or classes, such as susceptible, infectious, and recovered. The matrix is formed by calculating two key matrices: the infection matrix (F) and the transition matrix (V). The infection matrix represents the rate at which new infections occur, while the transition matrix represents the rate at which individuals transition between different states of infection.