24 aprile 2024 - esercizio 1 #57
Unanswered
CuriousCI
asked this question in
Esercitazioni 1
Replies: 3 comments
-
Questa è la mia soluzione, a mio parere fin troppo semplicistica, al solito commenti e alternative sono benvenuti. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Update MSTSiccome def update_MST(T,u,v,new_w):
P = BFS(T,u) #vettore dei padri da u in T
max = new_w #peso dell'arco (s,t) di peso maggiore nel ciclo
s = u
t = v
z = v
while(P[z] != z):
if(w(z,P[z]) > max):
max = w(z,P[z])
s = z
t = P[z]
z = P[z]
if(max != new_w):
T.remove((s,t))
T.add((u,v)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Beta Was this translation helpful? Give feedback.
All reactions