square_clustering(G, nodes=None)
For each node return the fraction of possible squares that exist at the node
$$C_4(v) = \frac{ \sum_{u=1}^{k_v} \sum_{w=u+1}^{k_v} q_v(u,w) }{ \sum_{u=1}^{k_v} \sum_{w=u+1}^{k_v} [a_v(u,w) + q_v(u,w)]},$$where $q_v(u,w)$ are the number of common neighbors of $u$ and $w$ other than $v$ (ie squares), and $a_v(u,w) = (k_u - (1+q_v(u,w)+\theta_{uv})) + (k_w - (1+q_v(u,w)+\theta_{uw}))$ , where $\theta_{uw} = 1$ if $u$ and $w$ are connected and 0 otherwise.
While $C_3(v)$ (triangle clustering) gives the probability that two neighbors of node v are connected with each other, $C_4(v)$ is the probability that two neighbors of node v share a common neighbor different from v. This algorithm can be applied to both bipartite and unipartite networks.
Compute clustering for nodes in this container.
A dictionary keyed by node with the square clustering coefficient value.
Compute the squares clustering coefficient for nodes.
>>> G = nx.complete_graph(5)
... print(nx.square_clustering(G, 0)) 1.0
>>> print(nx.square_clustering(G)) {0: 1.0, 1: 1.0, 2: 1.0, 3: 1.0, 4: 1.0}See :
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.bipartite.cluster.latapy_clustering
networkx.algorithms.cluster.square_clustering
networkx.algorithms.bipartite.cluster.robins_alexander_clustering
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