# Inferring Urban Social Networks from Publicly Available Data
## 2 Materials and Methods
### Territory, Population and Vertex Set  
We define the territory of interest in terms of an _origin_ and a regular lattice of \(T=T_{\text{lat}}\cdot T_{\text{Ion}}\) square tiles, i.e., by establishing the South-West corner of our bounding box, the side \(l\) of each tile and the number of tiles \(T_{\text{lat}}\) and \(T_{\text{Ion}}\) along the latitudinal and longitudinal axes, respectively. For the scope of this paper, \(l=1\) km for all cities. We then extract a geo-referenced population for the whole area of interest from the WorldPop Project ([[https://www.worldpop.org/](https://www.worldpop.org/)]([https://www.worldpop.org/](https://www.worldpop.org/)) (accessed on 23 April 2021)), which provides data of the world population for 100 m \(\times\) 100 m square cells. We resort to the overpass API of the well known OpenStreetMap database ([[https://www.openstreetmap.org/](https://www.openstreetmap.org/)]([https://www.openstreetmap.org/](https://www.openstreetmap.org/)) (accessed on 23 April 2021)) to find the minimal grid that contains the city's boundary; we then select only the tiles of the grid whose center lies inside it (see Appendix A). By mapping the WorldPop data to our tiles, we obtain a very precise estimate of the real population living in each tile. Albeit WorldPop--as well as other data sources--directly provides population densities for different age groups, we believe that all demographic parameters should be acquired from the same data source in order to improve the internal consistency of the model. Thus, any desired age-stratification can be easily specified in the simulator's configuration file in the form of a set of age groups and their respective frequencies. For the scope of this paper, we decided to rely on the Italian Institute of Statistics (ISTAT) (ISTAT data used in this paper are available at [[https://www.demo.istat.it/pop2020](https://www.demo.istat.it/pop2020)]([https://www.demo.istat.it/pop2020](https://www.demo.istat.it/pop2020)) (accessed on 23 April 2021)), which provides age distribution at the provincial level. The United Nations Statistics Division (UNSD) makes available similar data for many other countries ([[https://unstats.un.org/unsd/demographic-social/census/censusdates/](https://unstats.un.org/unsd/demographic-social/census/censusdates/)]([https://unstats.un.org/unsd/demographic-social/census/censusdates/](https://unstats.un.org/unsd/demographic-social/census/censusdates/)) (accessed on 23 April 2021)). Each vertex \(u\in V\) of our graph, which represents an individual of the population, thus, is characterized by three attributes:  
**Tile**: The tile label \(t_{u}\in\{0,\dots,T-1\}\) is set equal to the unique index of the tile where \(u\) resides. The age label \(g_{u}\in\{0,\ldots,n-1\}\) for vertex \(u\) is drawn independently at random from the given age-stratification. These labels determine a partition of the vertex set \(V\) into \(n\) disjoint subsets \(V_{0},\ldots,V_{n-1}\). Inspired by previous work, that modeled degree heterogeneity by means of a vertex-intrinsic fitness [14], we extract a sociability fitness attribute \(f_{u}>0\) for each \(u\). The probability of a friendship edge between \(u\) and \(v\) is then set proportional to \(f_{u}\) and \(f_{v}\) (see Section 2.3). Approximating the position of each vertex with its tile is instrumental in simplifying the computation of the household structure (see Section 2.2) and of pairwise distances. To this end, we use the approximation \(d(u,v)=\max\left\{\frac{1}{2},d^{*}(t_{u},t_{v})\right\}\), where \(t_{u}\) is the tile of \(u\), and \(d^{*}(t_{u},t_{v})\) denotes the distance between the center of \(t_{u}\) and the center of \(t_{v}\).