This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/networkx/algorithms/centrality/tests/test_voterank.py
2020-07-30 01:16:18 +02:00

21 lines
556 B
Python

"""
Unit tests for VoteRank.
"""
import networkx as nx
class TestVoteRankCentrality:
def test_voterank_centrality_1(self):
G = nx.Graph()
G.add_edges_from([(7, 8), (7, 5), (7, 9), (5, 0), (0, 1), (0, 2),
(0, 3), (0, 4), (1, 6), (2, 6), (3, 6), (4, 6)])
assert [0, 7, 6] == nx.voterank(G)
def test_voterank_centrality_2(self):
G = nx.florentine_families_graph()
d = nx.voterank(G, 4)
exact = ['Medici', 'Strozzi', 'Guadagni', 'Castellani']
assert exact == d