# Replicating File Segments between Multi-Cloud Nodes in a Smart City: A Machine Learning Approach
## 5 Using Machine Learning for Partial Replication and Selecting the Candidate Node
### Example of Using the Topology Operator  
In this section, an example is given about how operator is used. It is applied on the topology shown in Figure 3 We start with phase 1: \(\Phi\) paths with 1 st degree  
\[c_{1}\underset{\Phi}{\overset{1}{\underset{\Phi}{\rightleftharpoons}}}c_{2}= \Phi[1]\ \wedge\ \Phi[2]=[\ 1\ 1\ 0\ 0\ 0\ ] \tag{23}\]  
The result of calculating \(c_{1}\underset{\Phi}{\overset{1}{\underset{\Phi}{\rightleftharpoons}}}c_{2}\) in Equation (23) shows that \(c_{1}\) and \(c_{2}\) are directly connected but there is no third node that immediately connects them together. \[c_{1}\underset{\Phi}{\overset{1}{\underset{\Phi}{\rightleftharpoons}}}c_{3}= \Phi[1]\ \wedge\ \Phi[3]=[\ 1\ 0\ 1\ 0\ 0\ ] \tag{24}\]The result of calculating \(c_{1}\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{3}\) in Equation (24) shows that \(c_{1}\) and \(c_{3}\) are directly connected but there is no third node that immediately connects them together. \[c_{1}\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{4}=\Phi[1]\ \wedge\ \Phi[4]=[\ 0\ 1\ 1\ 0\ 0\ ] \tag{25}\]  
The result of calculating \(c_{1}\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{4}\) in Equation (25) shows that \(c_{1}\) and \(c_{4}\) are not directly connected. However, they are connected through the 1 st degree set \(\{c_{2},c_{3}\}\), which means \(c_{1}\) and \(c_{4}\) are reachable from each other either through intermediate cloud \(c_{2}\) or through intermediate node \(c_{3}\). \[c_{1}\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{5}=\Phi[1]\ \wedge\ \Phi[5]=[\ 0\ 0\ 0\ 0\ 0\ ] \tag{26}\]  
The result of calculating \(c_{1}\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{5}\) in Equation (26) shows that \(c_{1}\) and \(c_{5}\) are not directly connected and there is no 1 st degree connection that binds them together. We assume that connectivity is bi-directional, in other words, if \(c_{i}\) is reachable from \(c_{j}\) then \(c_{j}\) is reachable from \(c_{i}\). Based on this assumption, there is no need to test a node \(c_{i}\) with any node that has a lower index and that is why for \(c_{2}\) we start testing from \(c_{3}\). \[c_{2}\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{3}=\Phi[2]\ \wedge\ \Phi[3]=[\ 1\ 0\ 0\ 1\ 0\ ] \tag{27}\]  
Figure 3: A system Topology. The result of calculating \(c_{2}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{3}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}c_{3}}\) in Equation (27) shows that \(c_{2}\) and \(c_{4}\) are not directly connected but there are intermediate nodes that connect them together, namely \(c_{1}\) and \(c_{4}\). \[c_{2}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{4}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}c_{4}}=\Phi[2]\ \wedge\ \Phi[4]=[\ 0\ 1\ 0\ 1\ 0\ ] \tag{28}\]  
The result of calculating \(c_{2}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{4}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}}\) in Equation (28) shows that \(c_{2}\) and \(c_{4}\) are directly connected and there are no intermediate nodes that bind them together. \[c_{2}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{5}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}}=\Phi[2]\ \wedge\ \Phi[5]=[\ 0\ 0\ 0\ 1\ 0\ ] \tag{29}\]  
The result of calculating \(c_{2}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{5}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}}\) in Equation (29) shows that \(c_{2}\) and \(c_{5}\) are not directly connected but they are connected through intermediate node \(c_{4}\). \[c_{3}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{4}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}}=\Phi[3]\ \wedge\ \Phi[4]=[\ 0\ 0\ 1\ 1\ 0\ ] \tag{30}\]  
The result of calculating \(c_{3}\frac{\overset{1}{\underset{\Phi}{\rightleftarrow}}c_{4}}{\overset{1}{ \underset{\Phi}{\rightleftarrow}}}\) in Equation (30) shows that \(c_{3}\) and \(c_{4}\) are directly connected and there are no intermediate nodes that indirectly link them together.