Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / networkx / generators / tests / test_mycielski.py @ 5cef0f13

History | View | Annotate | Download (1.13 KB)

1
# test_mycielski.py - unit tests for the mycielski module
2
#
3
# Copyright 2010, 2011, 2012, 2013, 2014, 2015 NetworkX developers.
4
#
5
# This file is part of NetworkX.
6
#
7
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
8
# information.
9

    
10
"""Unit tests for the :mod:`networkx.generators.mycielski` module."""
11

    
12
from nose.tools import assert_true, assert_equal, raises
13
import networkx as nx
14
from networkx import *
15

    
16

    
17
class TestMycielski(object):
18

    
19
    def test_construction(self):
20
        G = nx.path_graph(2)
21
        M = mycielskian(G)
22
        assert_true(is_isomorphic(M, cycle_graph(5)))
23

    
24
    def test_size(self):
25
        G = nx.path_graph(2)
26
        M = mycielskian(G, 2)
27
        assert_equal(len(M), 11)
28
        assert_equal(M.size(), 20)
29

    
30
    def test_mycielski_graph_generator(self):
31
        G = mycielski_graph(1)
32
        assert_true(is_isomorphic(G, nx.empty_graph(1)))
33
        G = mycielski_graph(2)
34
        assert_true(is_isomorphic(G, nx.path_graph(2)))
35
        G = mycielski_graph(3)
36
        assert_true(is_isomorphic(G, cycle_graph(5)))
37
        G = mycielski_graph(4)
38
        assert_true(is_isomorphic(G, mycielskian(cycle_graph(5))))