Open
Description
ChristofidesAlgorithm/christofides.py
Line 129 in 7e85e6d
The current approach doesn't ensure minimum weighted edges from odd_vert with no two edge-sharing same vertices.
the function should be instead:
def minimum_weight_matching(MST, G, odd_vert):
vertices = []
for W, u, v in sorted((G[u][v], u, v)
for u in G
for v in G[u]
if v in odd_vert and u in odd_vert):
if u not in vertices and v not in vertices:
length = G[v][u]
MST.append((u, v, length))
vertices.append(u)
vertices.append(v)
Metadata
Metadata
Assignees
Labels
No labels