def single_source_bellman_ford_path_length(G, source, cutoff=None, weight='weight'):
 weight = _weight_function(G, weight)
 return iter(_bellman_ford(G, [source], weight, cutoff=cutoff).items())

def single_source_bellman_ford_path_length ( G , source , cutoff = None , weight = 'weight' ) : weight = _weight_function ( G , weight ) return iter ( _bellman_ford ( G , [ source ] , weight , cutoff = cutoff ) . items ( ) )
compute the shortest path length between source and all other reachable nodes for a weighted graph .