## 2 Methods
### Improved A* Algorithm for the Path Analysis of Restricted Networks
#### 2.1.3 Transfer Matrix  
Before introducing the transfer matrix, let's look at the adjacency matrix and its weight matrix. Figure 1 illustrates a restricted network composed of two lines, R\({}_{1}\) and R\({}_{2}\), with nodes 1-6 representing sites, and the edges in the network connecting between these sites. Each line has a predetermined direction, and there may be one or more public sites between them. The adjacency matrix, commonly used in network analysis, expresses the connectivity between nodes within a network. Similarly, for a restricted network, the adjacency matrix may be used to express the connectivity between sites. The element \(M_{ij}=k\) in the matrix indicates that there are \(k\) service lines that link the sites \(i\) and \(j\), and the diagonal element \(M_{ii}\) is 0. Figure 2 depicts the adjacency matrix for sites 1 to 4 in Figure 1. \(M_{24}=2\), indicating  
Figure 1: A restricted network. there are two lines, R\({}_{1}\) and R\({}_{2}\), connecting site 2 to site 4, establishing a connection between these sites. The weight matrix \(M^{m}_{ij}=k\) derived from the adjacency matrix T indicates that there are k plans from site \(i\) to site \(j\) through \(n-1\) transfers. For instance, \(M^{2}_{24}=4\) means that there is one transfer from site 2 to site 4, and there are four plans, namely R\({}_{1}\) (2\(\rightarrow\)3) to R\({}_{1}\) (3\(\rightarrow\)4); R\({}_{1}\) (2\(\rightarrow\)3) to R\({}_{2}\) (3\(\rightarrow\)4); R\({}_{2}\) (2\(\rightarrow\)3) to R\({}_{1}\) (3\(\rightarrow\)4); R\({}_{2}\) (2\(\rightarrow\)3) to R\({}_{2}\) (3\(\rightarrow\)4). While it is difficult in practice to transfer to the same automobile, this circumstance exists in theory. As mentioned earlier, the adjacency matrix and its weight matrix can be used to determine if any two points at varying numbers of transfers are connected (at least one transfer plan) or detached. Thus, obtaining the minimum number of transfers from site \(i\) to site \(j\), i.e., the minimum number of transfers required while there is at least one transfer plan from \(i\) to \(j\), is simple. The transfer matrix element \(Q_{ij}=n\) implies that the minimum number of transfers from \(i\) to \(j\) is \(n-1\). The calculation steps for the transfer matrix are as follows:  
1. Establish an adjacency matrix among sites and clear all elements of transfer matrix \(Q\). 2. Calculate the weight matrix \(M^{n}\) of the adjacency matrix, where n starts from 1 and accumulates sequentially. 3. Compare \(Q_{\bar{ij}}\) and \(M_{\bar{ij}}\) in order; if \(Q_{\bar{ij}}\)\(=0\) and \(M^{n}_{\bar{ij}}\
eq 0\), then \(Q_{\bar{ij}}=n\). 4. Repeat Steps 2 and 3 until all elements in \(Q\), except for the diagonal, are non-zero, and the loop ends. The transfer matrix for sites 1-4 is shown in Figure 3. The diagonal elements and the elements that cannot be accessed, regardless of the number of transfers between two points, are both set to 0 in this case. 1.4. Implementation Steps of the Improved A\({}^{*}\) Algorithm for the Path Analysis of Restricted Networks  
In this algorithm, for a restricted network, the multivariate heuristic function \(H(N)\) is used to estimate the cost of traveling from any point \(N\) to reach the ending point \(D\). In a restricted network, the shortest distance is no longer the most concerning travel criterion, as travel time and distance are correlated; generally, the longer the time, the larger the distance. Figure 3: The transfer matrix. Figure 2: The adjacency matrix and its weight matrix. Consequently, the distance priority in the multivariate heuristic function is lowest, and the distance is negligible, which means that the number of transfers, travel time, and travel cost become the key travel criteria in the restricted network. Therefore, \(G(N)\) denotes the price, including the number of transfers, the travel time, and the travel costs, paid from starting node \(O\) to any point \(N\).