Beispiel #1
0
 def test_negatively_weighted(self):
     with pytest.raises(nx.NetworkXError):
         G = nx.Graph()
         G.add_weighted_edges_from([(0, 1, -2), (1, 2, +1)])
         nx.global_reaching_centrality(G, weight='weight')
Beispiel #2
0
 def test_cycle_directed_weighted(self):
     G = nx.DiGraph()
     G.add_weighted_edges_from([(1, 2, 1), (2, 1, 1)])
     assert_equal(nx.global_reaching_centrality(G), 0)
Beispiel #3
0
 def test_non_positive_weights(self):
     with pytest.raises(nx.NetworkXError):
         G = nx.DiGraph()
         nx.global_reaching_centrality(G, weight='weight')
Beispiel #4
0
 def test_negatively_weighted(self):
     G = nx.Graph()
     G.add_weighted_edges_from([(0, 1, -2), (1, 2, +1)])
     nx.global_reaching_centrality(G, weight='weight')
Beispiel #5
0
 def test_cycle_undirected_unweighted(self):
     G = nx.Graph()
     G.add_edge(1, 2)
     assert_equal(nx.global_reaching_centrality(G, weight=None), 0)
 def test_undirected_weighted_star(self):
     G = nx.Graph()
     G.add_edge(1, 2, weight=1)
     G.add_edge(1, 3, weight=2)
     assert_equal(nx.global_reaching_centrality(G, normalized=False), 0.25)
Beispiel #7
0
 def test_non_positive_weights(self):
     G = nx.DiGraph()
     nx.global_reaching_centrality(G, weight='weight')
Beispiel #8
0
 def test_undirected_weighted_star(self):
     G = nx.Graph()
     G.add_edge(1, 2, weight=1)
     G.add_edge(1, 3, weight=2)
     assert_equal(nx.global_reaching_centrality(G, normalized=False), 0.25)
Beispiel #9
0
 def test_cycle_undirected_unweighted(self):
     G = nx.Graph()
     G.add_edge(1, 2)
     assert_equal(nx.global_reaching_centrality(G), 0)
Beispiel #10
0
 def test_negatively_weighted(self):
     G = nx.Graph()
     G.add_weighted_edges_from([(0, 1, -2), (1, 2, +1)])
     nx.global_reaching_centrality(G, weight='weight')
Beispiel #11
0
 def test_undirected_unweighted_star(self):
     G = nx.star_graph(2)
     assert_equal(nx.global_reaching_centrality(G, normalized=False), 0.25)
Beispiel #12
0
 def test_non_positive_weights(self):
     G = nx.DiGraph()
     nx.global_reaching_centrality(G)
Beispiel #13
0
 def test_cycle_directed_weighted(self):
     G = nx.DiGraph()
     G.add_edge(1, 2, weight=1)
     G.add_edge(2, 1, weight=1)
     assert_equal(nx.global_reaching_centrality(G, weight="weight"), 0)
Beispiel #14
0
 def test_cycle_directed_unweighted(self):
     G = nx.DiGraph()
     G.add_edge(1, 2)
     G.add_edge(2, 1)
     assert_equal(nx.global_reaching_centrality(G), 0)
Beispiel #15
0
 def test_cycle_undirected_unweighted(self):
     G = nx.Graph()
     G.add_edge(1, 2)
     assert nx.global_reaching_centrality(G, weight=None) == 0
Beispiel #16
0
 def test_cycle_directed_weighted(self):
     G = nx.DiGraph()
     G.add_edge(1, 2, weight=1)
     G.add_edge(2, 1, weight=1)
     assert_equal(nx.global_reaching_centrality(G, weight="weight"), 0)
Beispiel #17
0
 def test_cycle_directed_weighted(self):
     G = nx.DiGraph()
     G.add_weighted_edges_from([(1, 2, 1), (2, 1, 1)])
     assert nx.global_reaching_centrality(G) == 0
Beispiel #18
0
 def test_undirected_unweighted_star(self):
     G = nx.star_graph(2)
     assert_equal(nx.global_reaching_centrality(G, normalized=False), 0.25)