Repository navigation
Replies: 1 comment
def max_univoco(G):
total = 0
scelti = []
for u, adj in enumerate(G):
best = None
# trovo l'arco uscente di peso massimo
for (v, w) in adj:
if best is None or w > best[1]:
best = (v, w)
# lo prendo solo se ha peso positivo
if best is not None and best[1] > 0:
v, w = best
scelti.append((u, v, w))
total += w
return total, scelti |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
All reactions