Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / networkx / algorithms / centrality / tests / test_voterank.py @ 5cef0f13

History | View | Annotate | Download (602 Bytes)

1
"""
2
    Unit tests for VoteRank.
3
"""
4

    
5
from nose.tools import assert_equal
6

    
7
import networkx as nx
8

    
9

    
10
class TestVoteRankCentrality:
11
    def test_voterank_centrality_1(self):
12
        G = nx.Graph()
13
        G.add_edges_from([(7, 8), (7, 5), (7, 9), (5, 0), (0, 1), (0, 2),
14
                          (0, 3), (0, 4), (1, 6), (2, 6), (3, 6), (4, 6)])
15
        assert_equal([0, 7, 6], nx.voterank(G))
16

    
17
    def test_voterank_centrality_2(self):
18
        G = nx.florentine_families_graph()
19
        d = nx.voterank(G, 4)
20
        exact = ['Medici', 'Strozzi', 'Guadagni', 'Castellani']
21
        assert_equal(exact, d)