easygraph.functions.centrality.degree module#

easygraph.functions.centrality.degree.degree_centrality(G)[source]#

Compute the degree centrality for nodes in a bipartite network.

The degree centrality for a node v is the fraction of nodes it is connected to.

Parameters:

G (graph) – A easygraph graph

Returns:

nodes – Dictionary of nodes with degree centrality as the value.

Return type:

dictionary

Notes

The degree centrality are normalized by dividing by n-1 where n is number of nodes in G.

easygraph.functions.centrality.degree.in_degree_centrality(G)[source]#

Compute 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 EasyGraph graph

Returns:

nodes – Dictionary of nodes with in-degree centrality as values.

Return type:

dictionary

Raises:

EasyGraphNotImplemented: – If G is undirected.

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.

easygraph.functions.centrality.degree.out_degree_centrality(G)[source]#

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 EasyGraph graph

Returns:

nodes – Dictionary of nodes with out-degree centrality as values.

Return type:

dictionary

Raises:

EasyGraphNotImplemented: – If G is undirected.

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.