We follow the attention decoder from Kool et al. [1]}, which starts from a random node and outputs a probability distribution over its neighbors at each step.
Greedy search is used to perform the traversal over \(n\)  time steps and masking enforces constraints such as not visiting previously visited nodes.
At time step \(t\)  at node \(i\) , the decoder builds a context \(\hat{h}_{i}^{C}\)  for the partial tour \(\pi ^{\prime }_{t^{\prime }}\) , generated at time \(t^{\prime } < t\) , by packing together the graph embedding \(h_{G}\)  and the embeddings of the first and last node in the partial tour: \(\hat{h}_{i}^{C} = W_{C} \left[ \; h_{G}, \; h^{L}_{\pi ^{\prime }_{t-1}}, \; h^{L}_{\pi ^{\prime }_1} \; \right],\) 
where \(W_{C} \in \mathbb {R}^{3d \times d}\)  and learned placeholders are used for \(h^{L}_{\pi ^{\prime }_{t-1}}\)  and \(h^{L}_{\pi ^{\prime }_1}\)  at \(t = 1\) .
The context \(\hat{h}_{i}^{C}\)  is then refined via a standard Multi-Head Attention (MHA) operation [2]} over the node embeddings:
\(h_{i}^{C} = \text{MHA} \Big ( Q=\hat{h}_{i}^{C}, K=\lbrace h^{L}_1,\dots ,h^{L}_n\rbrace , V=\lbrace h^{L}_1,\dots ,h^{L}_n\rbrace  \Big ),\) 
