def set_node_attributes(G, name, values):
 if (not isinstance(values, dict)):
  values = dict(zip_longest(G, [], fillvalue=values))
 for (node, value) in values.items():
  G.node[node][name] = value

def set_node_attributes ( G , name , values ) : if ( not isinstance ( values , dict ) ) : values = dict ( zip_longest ( G , [ ] , fillvalue = values ) ) for ( node , value ) in values . items ( ) : G . node [ node ] [ name ] = value
sets node attributes from a given value or dictionary of values .