face2face.statistics.network_quantities.mean_degree_network

face2face.statistics.network_quantities.mean_degree_network(network)

Calculate average degree

Calculating the average degree of a given random network

\[\langle k \rangle = \frac{2 * \langle L \rangle}{N}\]
Parameters

network (networkx Graph) – A graph with a specified degree sequence. Nodes are labeled based on the imported dataset.

Returns

k – Contains the average degree for a network.

Return type

float

References

1

Barabasi, Albert-Laszlo. (2013). Network science. Philosophical transactions. Series A, Mathematical, physical, and engineering sciences. 371. 20120375. 10.1098/rsta.2012.0375.

Examples

>>> attr_list = ["ID", "Age", "Sex"]
>>> test_df = Data(path_tij="face2face/data/Test/tij_test.dat", separator_tij="\t",
>>>               path_meta="face2face/data/Test/meta_test.dat", separator_meta="\t",
>>>               meta_attr_list=attr_list)
>>> test_network = create_network_from_data(test_df)
>>> k = mean_degree_network(test_network)
>>> print(k)
2