numeric_mixing_matrix

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

Returns numeric mixing matrix for attribute.

Deprecated since version 2.6: numeric_mixing_matrix is deprecated and will be removed in 3.0. Use attribute_mixing_matrix instead.

Parameters
Ggraph

NetworkX graph object.

attributestring

Node attribute key.

nodes: list or iterable (optional)

Build the matrix only with nodes in container. The default is all nodes.

normalizedbool (default=True)

Return counts if False or probabilities if True.

mappingdictionary, optional

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

Returns
m: numpy array

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

Notes

If each node has a unique attribute value, the unnormalized mixing matrix will be equal to the adjacency matrix. To get a denser mixing matrix, the rounding can be performed to form groups of nodes with equal values. For example, the exact height of persons in cm (180.79155222, 163.9080892, 163.30095355, 167.99016217, 168.21590163, …) can be rounded to (180, 163, 163, 168, 168, …).