local function meld(node1,node2) if not node1 then return node2 elseif not node2 then return node1 elseif node1[1]dist[from]+cost then dist[to]=dist[from]+cost prev[to]=PairingHeap:new() prev[to]:push(from,from) pq:push(dist[to],{dist[to],to}) elseif dist[to]==dist[from]+cost then prev[to]:push(from,from) end end ::continue:: end local path={s} while path[#path]~=g do local cur=path[#path] local next=prev[cur]:top() table.insert(path,next) end print(table.concat(path," "))