Example #1
0
 def test_straightness_centrality(self):
     net = mm.straightness_centrality(self.network)
     net2 = mm.straightness_centrality(self.network,
                                       normalized=False,
                                       name="nonnorm")
     G = self.network.copy()
     G.add_node(1)
     net3 = mm.straightness_centrality(G)
     check = 0.8574045143712158
     nonnorm = 0.8574045143712158
     assert (net.nodes[(1603650.450422848,
                        6464368.600601688)]["straightness"] == check)
     assert net2.nodes[(1603650.450422848,
                        6464368.600601688)]["nonnorm"] == nonnorm
     assert (net3.nodes[(1603650.450422848,
                         6464368.600601688)]["straightness"] == check)
Example #2
0
 def test_mean_nodes(self):
     net = mm.straightness_centrality(self.network)
     mm.mean_nodes(net, "straightness")
     edge = 0.8777302256084243
     assert (net.edges[(1603226.9576840235, 6464160.158361825),
                       (1603039.9632033885, 6464087.491175889),
                       8, ]["straightness"] == edge)
Example #3
0
 def time_straightness_centrality(self):
     mm.straightness_centrality(self.network)