networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
attribute_mixing_dict(G, attribute, nodes=None, normalized=False)

Parameters

G : graph

NetworkX graph object.

attribute : string

Node attribute key.

nodes: list or iterable (optional) :

Unse nodes in container to build the dict. The default is all nodes.

normalized : bool (default=False)

Return counts if False or probabilities if True.

Returns

d : dictionary

Counts or joint probability of occurrence of attribute pairs.

Returns dictionary representation of mixing matrix for attribute.

Examples

>>> G = nx.Graph()
... G.add_nodes_from([0, 1], color="red")
... G.add_nodes_from([2, 3], color="blue")
... G.add_edge(1, 3)
... d = nx.attribute_mixing_dict(G, "color")
... print(d["red"]["blue"]) 1
>>> print(d["blue"]["red"])  # d symmetric for undirected graphs
1
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.assortativity.mixing.attribute_mixing_dict

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/assortativity/mixing.py#17
type: <class 'function'>
Commit: