void relax1(GraphRef G, int u, int v, PriorityQueueRef Q) { if(G->distances[v] > G->distances[u] + G->weights[u][v]) { G->distances[v] = G->distances[u] + G->weights[u][v]; G->parents[v] = u; if(inQueue(Q, v)) decreaseKey(Q, v, G->distances[v]); } } void relax2(GraphRef G, int u, int v) { if(G->distances[u] >= INF) return; if(G->distances[v] > G->distances[u] + G->weights[u][v]) { G->distances[v] = G->distances[u] + G->weights[u][v]; G->parents[v] = u; } }