# Inferring Urban Social Networks from Publicly Available Data
## 2 Materials and Methods
### Household Edges  
We group individuals into households according to a heuristics that uses the distribution of \"household roles\" per age and the distribution of the number of children per family, under the assumptions that: (i) all members of a household live in the same tile; (ii) children are younger than their parents; (iii) partners have, on average, a similar age. The algorithm is based on the concept of _household role_, represented as a pair of the form (household-type, role), whose possible values, for Italy, are reported in Table 2. For instance, \(r_{u}=\)(single-parent, parent) means that \(u\) is a parent in a household of type single-parent, where \(r_{u}[0]\)=single-parent is the household-type and \(r_{u}[1]\) = parent is the role. We make use of two conditional distributions: \(\Pr[r\mid g]\) is the probability that an individual has role \(r\) given that she/he belongs to age group \(g\); \(\Pr[k\mid h]\) is the probability that a household of type \(h\) has \(k\) members. This information is made available, as aggregate national data, by the ISTAT for Italy and, e.g., by the UNSD for many other countries.  
At a high level, the heuristics works as follows:  
1. Based on the distribution \(\Pr[r\mid g_{u}]\), extract a role \(r\) for each vertex \(u\).
2. For all \(u\) such that \(r_{u}[0]\in\{\)single-parent, two-parents\(\}\): 1. if \(r_{u}[0]=\) two-parents, select a random partner \(v\) for \(u\) such that \(t_{v}=t_{u}\), \(g_{v}\in[g_{u}-1,g_{u}+1]\) and \(r_{v}[0]=r_{u}[0]\); 2. based on the distribution \(\Pr[k\mid r_{u}[0]]\), extract the total number of members \(k_{u}\) for the household of \(u\) (and, in case, of \(v\)) and compute their total number of children \(c_{u}\).
3. For \(i=1,\ldots,\max_{u}c_{u}\): 1. for all \(u\) such that \(c_{u}\geq i\), select a random \(w\) such that \(t_{w}=t_{u}\), \(g_{w}<g_{u}\), \(r_{w}[0]=r_{u}[0]\) and \(r_{w}[1]\)= child, and assign \(w\) to the household of \(u\).
4. For all \(u\) such that \(r_{u}[0]=\) couples, select a random partner \(v\) for \(u\) such that \(t_{v}=t_{u}\), \(g_{v}\in[g_{u}-1,g_{u}+1]\) and \(r_{v}[0]=r_{u}[0]\); 5. based on the distribution \(\Pr[k\mid\text{various}]\), randomly compose the households of type various.  
In our simulations, the number of individuals not assigned to any household by the heuristics is negligible, and the empirical distributions of household types and members per type almost perfectly match the expected ones (see Appendix A for details). The household edges \(E_{H}\) are finally obtained as the union of all the _cliques_ that connect all members of the same household. Thus, the average degree of the household edges, denoted \(\
u\), is entirely data-driven.  
\begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Household Type** & **Singles** & **Single-Parent** & **Couples** & **Two-Parents** & **Various** \\ \hline
**Role** & single & parent & peer & parent & various \\  & & child & & child & \\ \hline \hline \end{tabular}  
* At a high level, the heuristics works as follows:
* Based on the distribution \(\Pr[r\mid g_{u}]\), extract a role \(r\) for each vertex \(u\).
* For all \(u\) such that \(r_{u}[0]\in\{\)single-parent, two-parents\(\}\): 1. if \(r_{u}[0]=\) two-parents, select a random partner \(v\) for \(u\) such that \(t_{v}=t_{u}\), \(g_{v}\in[g_{u}-1,g_{u}+1]\) and \(r_{v}[0]=r_{u}[0]\); 2. based on the distribution \(\Pr[k\mid r_{u}[0]]\), extract the total number of members \(k_{u}\) for the household of \(u\) (and, in case, of \(v\)) and compute their total number of children \(c_{u}\).
* For \(i=1,\ldots,\max_{u}c_{u}\): 1. for all \(u\)