face2face.statistics.network_quantities.average_path_length_network¶
-
face2face.statistics.network_quantities.
average_path_length_network
(network)¶ Calculate the average path length
Calculating the average path length <d> of a given network
\[d_{max} \approx \frac{\ln N}{\ln \langle k \rangle}\]- Parameters
network (networkx Graph) – A graph with a specified degree sequence. Nodes are labeled based on the imported data set.
- Returns
d – Contains the Average Path Length
- 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) >>> d = average_path_length_network(test_network) >>> print(d) 3.3219280948873626