def test_barbell_graph(self):
        # number of nodes = 2*m1 + m2 (2 m1-complete graphs + m2-path + 2 edges)
        # number of edges = 2*(number_of_edges(m1-complete graph) + m2 + 1
        m1=3; m2=5
        b=barbell_graph(m1,m2)
        assert_true(number_of_nodes(b)==2*m1+m2)
        assert_true(number_of_edges(b)==m1*(m1-1) + m2 + 1)
        assert_equal(b.name, 'barbell_graph(3,5)')

        m1=4; m2=10
        b=barbell_graph(m1,m2)
        assert_true(number_of_nodes(b)==2*m1+m2)
        assert_true(number_of_edges(b)==m1*(1-m1) + m2 + 1)
        assert_equal(b.name, 'barbell_graph(4,10)')

        m1=3; m2=20
        b=barbell_graph(m1,m2)
        assert_true(number_of_nodes(b)==2*m1+m2)
        assert_true(number_of_edges(b)==m1*(m1-1) + m2 + 1)
        assert_equal(b.name, 'barbell_graph(3,20)')

        # Raise NetworkXError if m1<2
        m1=1; m2=20
        assert_raises(networkx.exception.NetworkXError, barbell_graph, m1, m2)

        # Raise NetworkXError if m2<0
        m1=5; m2=-2
        assert_raises(networkx.exception.NetworkXError, barbell_graph, m1, m2)

        # barbell_graph(2,m) = path_graph(m+4)
        m1=2; m2=5
        b=barbell_graph(m1,m2)
        assert_true(is_isomorphic(b, path_graph(m2+4)))

        m1=2; m2=10
        b=barbell_graph(m1,m2)
        assert_true(is_isomorphic(b, path_graph(m2+4)))

        m1=2; m2=20
        b=barbell_graph(m1,m2)
        assert_true(is_isomorphic(b, path_graph(m2+4)))

        assert_raises(networkx.exception.NetworkXError, barbell_graph, m1, m2,
                      create_using=DiGraph())

        mb=barbell_graph(m1, m2, create_using=MultiGraph())
        assert_equal(sorted(mb.edges()), sorted(b.edges()))
dataset/ETHPy150Open networkx/networkx/networkx/generators/tests/test_classic.py/TestGeneratorClassic.test_barbell_graph/swapped operands of `-`