Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / networkx / algorithms / assortativity / tests / base_test.py @ 5cef0f13

History | View | Annotate | Download (1.51 KB)

1
import networkx as nx
2

    
3

    
4
class BaseTestAttributeMixing(object):
5

    
6
    def setUp(self):
7
        G = nx.Graph()
8
        G.add_nodes_from([0, 1], fish='one')
9
        G.add_nodes_from([2, 3], fish='two')
10
        G.add_nodes_from([4], fish='red')
11
        G.add_nodes_from([5], fish='blue')
12
        G.add_edges_from([(0, 1), (2, 3), (0, 4), (2, 5)])
13
        self.G = G
14

    
15
        D = nx.DiGraph()
16
        D.add_nodes_from([0, 1], fish='one')
17
        D.add_nodes_from([2, 3], fish='two')
18
        D.add_nodes_from([4], fish='red')
19
        D.add_nodes_from([5], fish='blue')
20
        D.add_edges_from([(0, 1), (2, 3), (0, 4), (2, 5)])
21
        self.D = D
22

    
23
        M = nx.MultiGraph()
24
        M.add_nodes_from([0, 1], fish='one')
25
        M.add_nodes_from([2, 3], fish='two')
26
        M.add_nodes_from([4], fish='red')
27
        M.add_nodes_from([5], fish='blue')
28
        M.add_edges_from([(0, 1), (0, 1), (2, 3)])
29
        self.M = M
30

    
31
        S = nx.Graph()
32
        S.add_nodes_from([0, 1], fish='one')
33
        S.add_nodes_from([2, 3], fish='two')
34
        S.add_nodes_from([4], fish='red')
35
        S.add_nodes_from([5], fish='blue')
36
        S.add_edge(0, 0)
37
        S.add_edge(2, 2)
38
        self.S = S
39

    
40

    
41
class BaseTestDegreeMixing(object):
42

    
43
    def setUp(self):
44
        self.P4 = nx.path_graph(4)
45
        self.D = nx.DiGraph()
46
        self.D.add_edges_from([(0, 2), (0, 3), (1, 3), (2, 3)])
47
        self.M = nx.MultiGraph()
48
        nx.add_path(self.M, range(4))
49
        self.M.add_edge(0, 1)
50
        self.S = nx.Graph()
51
        self.S.add_edges_from([(0, 0), (1, 1)])