Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

networkx.algorithms.assortativity.attribute_mixing_matrix

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

Returns mixing matrix for attribute.

Parameters
Ggraph

NetworkX graph object.

attributestring

Node attribute key.

nodes: list or iterable (optional)

Use only nodes in container to build the matrix. The default is all nodes.

mappingdictionary, optional

Mapping from node attribute to integer index in matrix. If not specified, an arbitrary ordering will be used.

normalizedbool (default=True)

Return counts if False or probabilities if True.

Returns
m: numpy array

Counts or joint probability of occurrence of attribute pairs.