networkx/networkx — pull request #1166 by chebee7i (2014-05-15 17:57:59+00:00)
Title: Allow set_*_attributes functions to work with single attribute value.

After reading @jtorrents https://github.com/networkx/networkx/issues/1162#issuecomment-43226198, I was curious about the `set_edge_attributes` functions and its friends. It would be convenient to be able to set the attribute for all edges with a single value as input, instead of having to construct a dict. Desired:

>>> G = nx.path_graph(5)
>>> nx.set_edge_attributes('weight', 10)

This sets the weight of every edge to 10. This will only work if the attribute value is not a dictionary. If it is a dictionary, then it is assumed to match the previous behavior (keys are edges and values are attribute values).

Also, the various functions were not functional for multigraphs. I've fixed that.