The macroscopic properties of polymers are significantly influenced by their macromolecular architecture. Linear polymers are characterized by their molar mass distribution, for branched polymers also the number, degree, and distribution of branching points is needed, while for network polymers a detailed insight into the molecular architecture of the polymer network is essential. Predicting the build-up of the macromolecular structure during polymerization is thus essential for predicting the final material properties, as well as their variation during polymerization or processing. Models currently available show limitations in terms of the computational cost and/or lack of generality of their approach. For this reason, the development of a generalization of the method originally developed by Macosko and Miller is presented. This algorithm can calculate the molar mass averages, including for example the z-average molar mass, gelation and the post-gel properties, such as the sol-, pending- and elastic effective mass fractions and crosslink density. Furthermore, the newly developed algorithm can cope with unequal reactivity of functional groups, substitution effects, competing parallel reactions involving the same or other functional groups, and with homo- and copolymerization alike. The algorithm is validated by comparing the results generated with literature for poly (urethane-isocyanurate) systems. The competing formation of urethane (carbamate) and isocyanurate groups is used to illustrate the capabilities of the algorithm, in view of the industrial relevance thereof.