easygraph.functions.basic.avg_degree module#
- easygraph.functions.basic.avg_degree.average_degree(G) float [source]#
Returns the average degree of the graph.
- Parameters:
G (graph) – A EasyGraph graph
- Returns:
average degree – The average degree of the graph.
- Return type:
float
Notes
Self loops are counted twice in the total degree of a node.
Examples
>>> G = eg.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G.add_edge(1, 2) >>> G.add_edge(2, 3) >>> eg.average_degree(G) 1.3333333333333333