Note

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

networkx.algorithms.assortativity.degree_mixing_matrix

degree_mixing_matrix(G, x='out', y='in', weight=None, nodes=None, normalized=True)[source]

Returns mixing matrix for attribute.

Parameters
Ggraph

NetworkX graph object.

x: string (‘in’,’out’)

The degree type for source node (directed graphs only).

y: string (‘in’,’out’)

The degree type for target node (directed graphs only).

nodes: list or iterable (optional)

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

weight: string or None, optional (default=None)

The edge attribute that holds the numerical value used as a weight. If None, then each edge has weight 1. The degree is the sum of the edge weights adjacent to the node.

normalizedbool (default=True)

Return counts if False or probabilities if True.

Returns
m: numpy array

Counts, or joint probability, of occurrence of node degree.