For any two nodes i, j in the lattice graph, the matrix entry L ij is the minimum relative distance between them.
if the nodes i, j share at least one path, then we have where L p •0 is the distance to the source node in path p. If no common path exists for two nodes, we denote the relative distance as −∞ (−10 9 in practice) for subsequent masking in the lattice attention.