# Optimal Transport in Multilayer Networks for Traffic Flow Optimization
## 2 Materials and Methods  
### Multilayer Transportation Networks  
In general, a multilayer network is represented as a graph \(G(\{\mathcal{V}_{\alpha}\}_{\alpha},\{\mathcal{E}_{\alpha}\}_{\alpha^{\prime}}, \{\mathcal{E}_{\alpha\gamma}\}_{\alpha_{\gamma}})\), where \(\mathcal{V}_{\alpha}\) and \(\mathcal{E}_{\alpha}\) are the set of nodes and edges in layer \(\alpha\), respectively, and \(\mathcal{E}_{\alpha\gamma}\) is the set of edges between nodes in layer \(\alpha\) and nodes in layer \(\gamma\). Here, \(\alpha=1,\ldots,L\), where \(L\) is the number of layers. We denote with \(N_{\alpha}=|\mathcal{V}_{\alpha}|\) the number of nodes in layer \(\alpha\), and with \(E_{\alpha}=|\mathcal{E}_{\alpha}|\) the number of edges in layer \(\alpha\), \(E_{\alpha\gamma}=|\mathcal{E}_{\alpha\gamma}|\) is the number of edges between nodes in layer \(\alpha\) and \(\gamma\). Finally, we denote with \(\mathcal{V}_{0}=\cup_{\alpha}\mathcal{V}_{\alpha}\) the total set of nodes, with \(\mathcal{E}_{0}=(\cup_{\alpha}\mathcal{E}_{\alpha})\cup(\cup_{\alpha\gamma} \mathcal{E}_{\alpha\gamma})\) the total set of edges, and with \(N_{0}=|\mathcal{V}_{0}|\) and \(E_{0}=|\mathcal{E}_{0}|\), their cardinalities. We assume that edges have lengths \(l_{e}>0\), which determine the cost to travel through them. Transportation networks are relevant examples of this type of structure, where nodes are stations, edges are connections between stations and layers are transportation modes, for instance, rails or bus routes. A convenient way to represent a multilayer network is with two tensors [43]: (i) an intra-layer adjacency tensor \(A\) with entries \(A^{\alpha}_{uv}=1\) if there is an edge between nodes \(u\) and \(v\) in layer \(\alpha\), and 0 otherwise. We refer to this type of edge as an _intra-layer_ edge; (ii) an inter-layer adjacency tensor \(\hat{A}\) with entries \(\hat{A}^{\alpha\gamma}_{uv}=1\) if there is an edge between node \(u\) in layer \(\alpha\) and node \(v\) in layer \(\gamma\), and 0 otherwise. Without loss of generality, in our applications, we have \(\hat{A}^{\alpha\gamma}_{uv}=0\) if \(u\
eq v\), meaning that different layers are connected solely by shared nodes. We refer to edges connecting nodes in different layers as _inter-layer_ edges. In the case of transportation networks, the main application studied here, a station could have a bus stop, a train platform and a subway entrance, which allows passengers to switch between communication modes within the same station. For example, one can think of an inter-layer edge as the stairs connecting the subway entrance with the entrance to the train station. Typically, inter-layer edges are, thus, much shorter than intra-layer edges. In the case of multilayer networks, we need to be careful with how stations connecting multiple transportation modes are represented. In fact, if an entry station connects more than one layer, we may not be able to distinguish in what layer a passenger enters. In other words, if a node \(u\) belongs to more than one layer, i.e., a node \(u_{\alpha}\) exists for more than one value of \(\alpha\), we may not be able to tell whether the passengers entering \(u\) entered from \(u_{\alpha}\), \(u_{\gamma}\) or from any of the other instances of node \(u\) in the various layers. To alleviate this problem, we build auxiliary _super_ nodes \(u\), which do not belong to any layer in particular but instead connect the various instances of the same node in the various layers together. Specifically, we remove all the inter-layer edges \((u_{\alpha},u_{\gamma})\) and replace them with auxiliary _inter-super_ edges \((u_{\alpha},u)\), connecting all the instances \(u_{\alpha}\) of node \(u\) with the super node \(u\), as in a star graph, so that the original edge \((u_{\alpha},u_{\gamma})\) is replaced by a two-edge path \(\{(u_{\alpha},u),(u_{\gamma},u)\}\).