This is the companion code to the paper "Inferring the minimum spanning tree from a sample network" by Jonathan Larson and Jukka-Pekka Onnela, available at https://arxiv.org/abs/2102.09879. This is the code used to run all the simulations described in the paper, and to analyze the data. The data were obtained from the Primary Infection Resource Consortium (PIRC; https://www.pirc.ucsd.edu). The data are not in the public domain due to privacy reasons but one can submit an application to gain access.