def max_edge(g, src, dst, n):
 w1 = g[n].get(src, {'weight': (- np.inf)})['weight']
 w2 = g[n].get(dst, {'weight': (- np.inf)})['weight']
 return {'weight': max(w1, w2)}

def max_edge ( g , src , dst , n ) : w1 = g [ n ] . get ( src , { 'weight' : ( - np . inf ) } ) [ 'weight' ] w2 = g [ n ] . get ( dst , { 'weight' : ( - np . inf ) } ) [ 'weight' ] return { 'weight' : max ( w1 , w2 ) }
callback to handle merging nodes by choosing maximum weight .