# Recommendation Algorithm for Multi-Task Learning with Directed Graph Convolutional Networks
## 3 Multi-Task Learning Recommendation Model for Directed Graph Convolutional Networks
### Preprocessing Layer of the DGCNR Layer  
The session sequence of the user's micro-behavior is \(s=\{m_{1},m_{2},...,m_{N}\}\). Let \(V=\{m_{1},m_{2},...,m_{N}\}\) is the set of all items involved in all user session information with duplicates removed. Each session sequence \(s\) is modeled as a directed graph \(G_{s}=(V_{s},E_{s})\). Each node represents an item \(m_{s,i}\in V\), and each edge \((m_{s,i-1},m_{s,i})\in E_{s}\) represents the user's operation \(m_{s,i}\) after the operation \(m_{s,i-1}\) in session \(s\). For example, Figure 3 describes the user behavior sequence, there are three users in total, namely U1, U2, and U3, and the corresponding user session graph is shown in Figure 4.  
In the directed graph, we should not only consider the neighbor nodes, but also the proximity nodes of each node. In Figure 4, the definition [46] of first-order proximity nodes and second-order proximity nodes is cited, and the corresponding proximity nodes representation graph is shown in Figure 5. Node \(m_{1}\) and \(m_{2}\) are directly connected by an edge, and node \(m_{2}\) (\(m_{1}\)) is the neighbor node of \(m_{1}\) (\(m_{2}\)), as shown in Figure 5a. Node \(m_{1}\) and node \(m_{4}\) have no edge directly connected, but they have a common neighbor \(m_{2}\), and  
Figure 4: User session graph. Figure 3: User behavior sequences. edges \(<\)\(m_{2}\), \(m_{1}\)\(>\) and \(<\)\(m_{2}\), \(m_{4}\)\(>\) exist, \(m_{4}\) (\(m_{1}\)) is the second-order in-degree neighbor node of \(m_{1}\) (\(m_{4}\)), as shown in Figure 5b; node \(m_{2}\) and node \(m_{6}\) are not directly connected by edges, but they have a common neighbor \(m_{2}\), and edges \(<\)\(m_{1}\), \(m_{2}\)\(>\) and \(<\)\(m_{6}\), \(m_{2}\)\(>\) exist, \(m_{6}\)(\(m_{1}\)) is the second-order out-degree proximity node of \(m_{1}\) (\(m_{6}\)), as shown in Figure 5c. The proximity relationship between nodes in a directed graph can be described by a matrix. The first-order proximity relationship corresponds to the first-order proximity matrix, and the second-order proximity relationship corresponds to the second-order in-degree proximity matrix and the second-order out-degree proximity matrix, they are all symmetric matrices. The first-order proximity matrix is represented by \(A_{F}\), and the value rule for the elements at \((i,j)\) is as follows. If there is no edge from node \(m_{i}\) to node \(m_{j}\) or from node \(m_{j}\) to node \(m_{i}\), then \(A_{F}(i,j)=0\). If there is only one edge from node \(m_{i}\) to node \(m_{j}\), then \(A_{F}(i,j)=1\). If there is only one edge from node \(m_{j}\) to node \(m_{i}\), then \(A_{F}(i,j)=-1\). There may be several items that appear repeatedly in the sequence, and a normalized weight needs to be assigned to the bidirectional edge. The elements of \(A_{F}\) are not limited to 0, 1, and \(-1\), Taking the directed graph of Figure 4 as an example, the first-order proximity matrix \(A_{F}\) can be expressed as:  
\[ \begin{bmatrix}0&1/2&-1&0&0&0\\ 1/2&0&0&1&0&-1\\ 1&0&0&-1&1&0\\ 0&-1&1&0&0&1\\ 0&0&-1&0&0&0\\ 0&1&0&-1&0&0\end{bmatrix} \]  
The element value at (\(i\),\(j\)) in the second-order in-degree proximity matrix \(A_{Sin}\) is calculated by Formula (1), and the element value at (\(i\),\(j\)) in the second-order out-degree proximity matrix \(A_{Sout}\) is calculated by Formula (2), where \(A_{k,j}\) represents the element at adjacent matrix \(A\)_of directed graph_ and \(k\), \(m\)\(\in\)V\({}_{\text{S}}\). \[A_{Sin}(i,j)=\sum_{k}\frac{A_{k,i}A_{k,j}}{\sum_{m}A_{k,m}} \tag{1}\]  
\[A_{Sout}(i,j)=\sum_{k}\frac{A_{i,k}A_{j,k}}{\sum_{m}A_{m,k}} \tag{2}\]  
The output of the input layer is the session sequences of the user's micro-behavior, which is then input into the preprocessing layer.