dist1 and dist2, to store the minimum and second minimum time to reach each node, respectively.dist1[neighbor] is not set, update it with the calculated time. Otherwise, try to update dist2[neighbor] if it's not set or if the calculated time is smaller but not equal to dist1[neighbor].