def hungarian(B ,pos ,cost):
n = len(cost)
ret = 0;
max_match = 0
xy = [-1] * n
yx = [-1] * n
slack = [0] * n
slackx = [0] * n
lx, ly = init_labels(cost)
augment(cost, max_match, xy, yx, lx, ly, slack, slackx)
for x in range(n):
if (x, chr(xy[x]+97)) in B.edges():
nx.draw_networkx_edges(B, pos, edgelist = [(x, chr(xy[x]+97))], width = 2.5, alpha = 0.6, edge_color = 'r')
#takes input from the file and creates a weighted bipartite graph
assignment_prob_hungarian.py 文件源码
python
阅读 35
收藏 0
点赞 0
评论 0
评论列表
文章目录