Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.assortativity.numeric_mixing_matrix

numeric_mixing_matrix(G, attribute, nodes=None, normalized=True)[source]

Return numeric mixing matrix for attribute.

The attribute must be an integer.

Parameters:
  • G (graph) – NetworkX graph object.
  • attribute (string) – Node attribute key. The corresponding attribute must be an integer.
  • nodes (list or iterable (optional)) – Build the matrix only with nodes in container. The default is all nodes.
  • normalized (bool (default=True)) – Return counts if False or probabilities if True.
Returns:

m – Counts, or joint, probability of occurrence of node attribute pairs.

Return type:

numpy array