effective_size(G, nodes=None, weight=None)
The effective size of a node's ego network is based on the concept of redundancy. A person's ego network has redundancy to the extent that her contacts are connected to each other as well. The nonredundant part of a person's relationships it's the effective size of her ego network . Formally, the effective size of a node $u$, denoted $e(u)$, is defined by
$$e(u) = \sum_{v \in N(u) \setminus \{u\}} \left(1 - \sum_{w \in N(v)} p_{uw} m_{vw}\right)$$where $N(u)$ is the set of neighbors of $u$ and $p_{uw}$ is the normalized mutual weight of the (directed or undirected) edges joining $u$ and $v$, for each vertex $u$ and $v$ . And $m_{vw}$ is the mutual weight of $v$ and $w$ divided by $v$ highest mutual weight with any of its neighbors. The mutual weight of $u$ and $v$ is the sum of the weights of edges joining them (edge weights are assumed to be one if the graph is unweighted).
For the case of unweighted and undirected graphs, Borgatti proposed a simplified formula to compute effective size
$$e(u) = n - \frac{2t}{n}$$where t
is the number of ties in the ego network (not including ties to ego) and n
is the number of nodes (excluding ego).
Burt also defined the related concept of efficiency of a node's ego network, which is its effective size divided by the degree of that node . So you can easily compute efficiency:
>>> G = nx.DiGraph() >>> G.add_edges_from([(0, 1), (0, 2), (1, 0), (2, 1)]) >>> esize = nx.effective_size(G) >>> efficiency = {n: v / G.degree(n) for n, v in esize.items()}
The graph containing v
. Directed graphs are treated like undirected graphs when computing neighbors of v
.
Container of nodes in the graph G
to compute the effective size. If None, the effective size of every node is computed.
If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight.
Dictionary with nodes as keys and the effective size of the node as values.
Returns the effective size of all nodes in the graph G
.
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