diff options
author | Michael Holtz <mjh9122@rit.edu> | 2022-11-14 09:00:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 15:00:09 +0100 |
commit | 838b06c2233b8b22df6c1f43e3a91a963749a89b (patch) | |
tree | 3f9b3ae367ea07a999baf1a5d7a381315e037b70 /networkx/algorithms | |
parent | 36e29e89e4247807f053bd6f951bc9db4e3ca4b6 (diff) | |
download | networkx-838b06c2233b8b22df6c1f43e3a91a963749a89b.tar.gz |
Tests added in test_centrality.py (#6200)
Diffstat (limited to 'networkx/algorithms')
-rw-r--r-- | networkx/algorithms/bipartite/tests/test_centrality.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/networkx/algorithms/bipartite/tests/test_centrality.py b/networkx/algorithms/bipartite/tests/test_centrality.py index 50ac9064..19fb5d11 100644 --- a/networkx/algorithms/bipartite/tests/test_centrality.py +++ b/networkx/algorithms/bipartite/tests/test_centrality.py @@ -55,6 +55,22 @@ class TestBipartiteCentrality: c = bipartite.closeness_centrality(G, [1]) assert c == {0: 0.0, 1: 0.0} + def test_bipartite_closeness_centrality_unconnected(self): + G = nx.complete_bipartite_graph(3, 3) + G.add_edge(6, 7) + c = bipartite.closeness_centrality(G, [0, 2, 4, 6], normalized=False) + answer = { + 0: 10.0 / 7, + 2: 10.0 / 7, + 4: 10.0 / 7, + 6: 10.0, + 1: 10.0 / 7, + 3: 10.0 / 7, + 5: 10.0 / 7, + 7: 10.0, + } + assert c == answer + def test_davis_degree_centrality(self): G = self.davis deg = bipartite.degree_centrality(G, self.top_nodes) |