# Inferring Urban Social Networks from Publicly Available Data
## Appendix A Population Synthesis: Territory and Households  
The first step to building a synthetic, but realistic, population for a territory of interest consists in the definition of the territory itself. We resorted to the well known OpenStreetMap database by means of the overpass API: for each city/municipality of interest, we download the shape file with its boundary. This is used, at first, to find out the territory grid as the minimal rectangle that contains the shape and, later, to select only the tiles of the grid whose center actually falls inside the shape. This simple technique allows to reproduce with a high accuracy the actual number of people living in the selected area. Comparing our reconstructed population with the ISTAT data, we observed a difference of \(\approx\)1% for all the three cities of Florence, Sabaudia, and Viterbo. Figure 10(a) is the analogous to Figure 10(a,b) for Viterbo and shows the selected area with the city shape and a sample population of 1000 individuals. As mentioned in Section 2.1, we aim at recreating a synthetic population that is statistically indistinguishable from the real one. To this end, we selected the following sources of information: (i) population density data from the WorldPop project [42]; (ii) ISTAT age distribution data aggregated at the provincial level (for Sabaudia, we used the Province of Latina, to which the city belongs); (iii) due to the absence of analogous data at any greater resolution, we use ISTAT household composition and frequency data aggregated at the national level. The reconstructed population density for the city of Florence is depicted in Figure 10. The set of available household types and roles based on ISTAT data are reported in Table 2, where \"various\" comprehensnds all possible cases not included in the previous instances (e.g., non-partner adults living together). It is worth it to underline that acquiring all data from the same source was unfortunately impossible. In particular, albeit WorldPop makes available an age-stratified population density, we verified that using those data induces an age distribution that is inconsistent with ISTAT data on household composition. Based on the collected data, we extract the tile label \(t_{u}\) and the age label \(g_{u}\) for each individual \(u\) of the population, as defined in Section 2.1. We also assign a role to each agent based on the joint-distribution of age and household roles provided by ISTAT, i.e., conditioning on \(g_{u}\) when we draw \(u\)'s role \(r_{u}\). We then generate the households with the algorithm described in Section 2.2. We assess the robustness of the algorithm under perturbations to the age distribution, by considering independent relative variations--either positive or negative--to the probability of each age-group, controlled by a real-valued parameter \(\omega\). Formally, if \(\pi_{i}=\frac{|V|}{N}\) is the data-driven probability of age group \(i\), the perturbed value \(\pi_{i}^{*}\) is obtained as follows: we draw \(\epsilon\sim\frac{1}{2}\mathcal{N}(\omega,\omega^{2})+\frac{1}{2}\mathcal{N} (-\omega,\omega^{2})\), where \(\mathcal{N}(\lambda,\sigma^{2})\) denotes the normal distribution with mean \(\mu\) and variance \(\sigma^{2}\); we set \(\pi_{i}^{*}=\pi_{i}\cdot(1+\epsilon)\); we normalize \(\pi_{i}^{*}\) so that \(\sum_{i=1}^{n}\pi_{i}^{*}=1\). For both \(\omega=0.01\) and \(\omega=0.1\), we pick 20 different perturbed age distributions, and we evaluate the quality of the resulting households under perturbation to the input data. First, we address the problem that our heuristics does not guarantee that all individuals of the population are assigned to some household. For instance, this may happen if in any of the tiles the number of \"single parents\" exceeds the number of \"children of a single parent\".