def scale_edge_weights(edge_weights, w):
    """ Scales all the edge-weights described by a dictionary. """
    edge_weights2 = {}
    for (n1, n2) in edge_weights.keys():
        edge_weights2[(n1, n2)] = w * edge_weights[(n1, n2)]
    return edge_weights2