-
Notifications
You must be signed in to change notification settings - Fork 0
/
measures.py
104 lines (57 loc) · 2.23 KB
/
measures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import networkx as nx
# two classes:
# nodes and whole graph measures
class Node_Measures:
def degree_centrality(self, G):
return nx.degree_centrality(G)
def betweenness_centrality(self, G):
return nx.betweenness_centrality(G)
def closeness_centrality(self, G):
return nx.closeness_centrality(G)
def eigenvector_centrality(self, G):
return nx.eigenvector_centrality(G, max_iter=1000)
def pagerank(self, G):
return nx.pagerank(G)
def katz_centrality(self, G):
try:
return nx.katz_centrality(G, max_iter=10000)
except:
return dict(zip(list(G.nodes()), [None]*len(list(G.nodes()))))
def load_centrality(self, G):
return nx.load_centrality(G)
def percolation_centrality(self, G):
return nx.percolation_centrality(G)
def closeness_vitality(self, G):
return nx.closeness_vitality(G)
#def normalized_fisher_information(self, G):
# https://gitlab.com/cristophersfr/fisher-networks
# https://www.nature.com/articles/s41598-019-53167-5
# return G
def clustering_coefficient(self, G):
return nx.clustering(G)
#def transfer_entropy(self, G):
# https://royalsocietypublishing.org/doi/10.1098/rspa.2019.0779
# return G
class Network_Measures:
def average_node_connectivity(self, G):
return nx.average_node_connectivity(G)
def non_randomness(self, G):
return nx.non_randomness(G)
def small_world_omega(self, G):
return nx.omega(G)
def normalized_network_centrality(self, G):
# https://gitlab.com/cristophersfr/fisher-networks
# https://www.nature.com/articles/s41598-019-53167-5
return G
#def network_fisher_information(self, G):
# https://gitlab.com/cristophersfr/fisher-networks
# https://www.nature.com/articles/s41598-019-53167-5
# return G
def kolmogorov_complexity(self, G):
# https://github.com/sztal/pybdm
# https://journals.aps.org/pre/pdf/10.1103/PhysRevE.96.012308
return G
class Dynamic_Measures:
def control_kernel(self, G):
# https://royalsocietypublishing.org/doi/10.1098/rspa.2019.0779
return G