a
HlX`§ã@sDdZddlmZgd¢Zdd„Zedƒdd„ƒZedƒd d
„ƒZdS)zDegree centrality measures.é)Únot_implemented_for)Údegree_centralityÚin_degree_centralityÚout_degree_centralitycsDt|ƒdkrdd„|DƒSdt|ƒd‰‡fdd„| ¡Dƒ}|S)aèCompute the degree centrality for nodes.
The degree centrality for a node v is the fraction of nodes it
is connected to.
Parameters
----------
G : graph
A networkx graph
Returns
-------
nodes : dictionary
Dictionary of nodes with degree centrality as the value.
See Also
--------
betweenness_centrality, load_centrality, eigenvector_centrality
Notes
-----
The degree centrality values are normalized by dividing by the maximum
possible degree in a simple graph n-1 where n is the number of nodes in G.
For multigraphs or graphs with self loops the maximum degree might
be higher than n-1 and values of degree centrality greater than 1
are possible.
écSsi|]
}|d“qS©r©©Ú.0Únrrú‘/Users/cmdms/OneDrive-UOB/Development/Projects/2021/sam-consensus-v3/env/lib/python3.9/site-packages/networkx/algorithms/centrality/degree_alg.pyÚ
%óz%degree_centrality..çð?csi|]\}}||ˆ“qSrr©r
rÚd©Úsrrr
(r)ÚlenZdegree©ÚGZ
centralityrrrrs
rZ
undirectedcsDt|ƒdkrdd„|DƒSdt|ƒd‰‡fdd„| ¡Dƒ}|S)a9Compute the in-degree centrality for nodes.
The in-degree centrality for a node v is the fraction of nodes its
incoming edges are connected to.
Parameters
----------
G : graph
A NetworkX graph
Returns
-------
nodes : dictionary
Dictionary of nodes with in-degree centrality as values.
Raises
------
NetworkXNotImplemented
If G is undirected.
See Also
--------
degree_centrality, out_degree_centrality
Notes
-----
The degree centrality values are normalized by dividing by the maximum
possible degree in a simple graph n-1 where n is the number of nodes in G.
For multigraphs or graphs with self loops the maximum degree might
be higher than n-1 and values of degree centrality greater than 1
are possible.
rcSsi|]
}|d“qSrrr rrrr
Prz(in_degree_centrality..rcsi|]\}}||ˆ“qSrrrrrrr
Sr)rZ in_degreerrrrr,s
#rcsDt|ƒdkrdd„|DƒSdt|ƒd‰‡fdd„| ¡Dƒ}|S)a;Compute the out-degree centrality for nodes.
The out-degree centrality for a node v is the fraction of nodes its
outgoing edges are connected to.
Parameters
----------
G : graph
A NetworkX graph
Returns
-------
nodes : dictionary
Dictionary of nodes with out-degree centrality as values.
Raises
------
NetworkXNotImplemented
If G is undirected.
See Also
--------
degree_centrality, in_degree_centrality
Notes
-----
The degree centrality values are normalized by dividing by the maximum
possible degree in a simple graph n-1 where n is the number of nodes in G.
For multigraphs or graphs with self loops the maximum degree might
be higher than n-1 and values of degree centrality greater than 1
are possible.
rcSsi|]
}|d“qSrrr rrrr
{rz)out_degree_centrality..rcsi|]\}}||ˆ“qSrrrrrrr
~r)rZ
out_degreerrrrrWs
#rN)Ú__doc__Znetworkx.utils.decoratorsrÚ__all__rrrrrrrÚs%
*