def attribute_mixing_matrix(G, attribute, nodes=None, mapping=None, normalized=True):
 d = attribute_mixing_dict(G, attribute, nodes)
 a = dict_to_numpy_array(d, mapping=mapping)
 if normalized:
  a = (a / a.sum())
 return a

def attribute_mixing_matrix ( G , attribute , nodes = None , mapping = None , normalized = True ) : d = attribute_mixing_dict ( G , attribute , nodes ) a = dict_to_numpy_array ( d , mapping = mapping ) if normalized : a = ( a / a . sum ( ) ) return a
return mixing matrix for attribute .