## 2 The Proposed Model Algorithm
### Item Representation Learning of the Conversation Layer  
#### 2.2.1. Constructing the Session Graph  
The session graph is a weighted directed graph, denoted as \(G_{s}=(V_{s},\ E_{s})\). We can capture the session-level item representation based on the item transition relationship in the current session sequence \(S_{i}=\{s_{1,1},s_{1,2},\ldots,s_{i,t}\}\). The node set \(V_{s}\) represents the set of all items involved in all sessions, and the edge set \(E_{s}\) is the representation of all item transition relationships in the session \(S\) that appear in \(V_{s}\). The edge \((v_{i,t-1},\ v_{i,t+1})\) indicates that in the session \(S_{i}\), the user clicked on the item \(v_{i,t-1}\) at time \(t\), and then clicked on the item \(v_{i,t+1}\) at the next time step.  
Since the task of session recommendation is to recommend the next interaction item for the current session, in general, the last interaction item has a greater impact on the next interaction. Therefore, the closer the node is to the end of the session, the greater its influence on the session recommendation. So, in the process of constructing the session graph, we consider using the interaction sequence of nodes in the session as the weight information in the relationship matrix and assign different weights according to the interaction order position of nodes in the session. For example, for the session \(S_{1}=\{v_{1},\ v_{2},\ v_{3},\ v_{4},\ v_{3},\ v_{1}\}\), which is shown in the following Figure 2.  
Figure 2: Construction of the session graph for session \(S_{1}\).  
According to the weighted session graph constructed above, the connection matrix \(M_{1}\) of the session graph can be obtained as shown in the following Figure 3.  
Because the actual session sequence data have different lengths, we normalize the weight information, and the specific normalization method is as follows:  
\[Weight(x)=Mean_{5}\times(\frac{1}{1+e^{-\frac{x}{2}}}) \tag{1}\]  
\(Weight(x)\) represents the weight information in the connection matrix \(M_{1}\), \(x\in\{1,2,3,4,\ \ldots,n\}\), \(Mean_{5}\) represents the average session length of the session sequence data. According to the above weight information normalization formula, the final output weight size can be mapped to \((0,\ Mean_{5})\). According to the average session length of the session data used in the experimental part of this paper, the weight information normalization curve is shown in the following Figure 4.  
For the case where there are multiple repeated sequential interactions between two nodes in some session data, such as the edge \((v_{i,t-1},\ v_{i,t+1})\) appearing multiple times, we take the weight value of the last occurrence. After normalizing the weight information according to the above, we obtain the standardized connection matrix \(M_{1}^{\prime}\) of session \(S_{1}\) as the following Figure 5.  
Figure 4: The standardized curve of weight information.  
Figure 3: The initial connection matrix \(M_{1}\) of the session.  
The connection matrix \(M_{1}^{\prime}\) serves as a crucial input feature for the following network model. It integrates its feature information with the parameter information of the graph neural network to propagate its own feature information to its neighboring nodes, and also receives feature information from its neighboring nodes. Therefore, it updates itself based on the aggregation of its own and neighboring information.