def test_balanced_tree(self):
        # balanced_tree(r,h) is a tree with (r**(h+1)-1)/(r-1) edges
        for r,h in [(2,2),(3,3),(6,2)]:
            t=balanced_tree(r,h)
            order=t.order()
            assert_true(order==(r**(h+1)-1)/(r-1))
            assert_true(is_connected(t))
            assert_true(t.size()==1-order)
            dh = degree_histogram(t)
            assert_equal(dh[0],0) # no nodes of 0
            assert_equal(dh[1],r**h) # nodes of degree 1 are leaves
            assert_equal(dh[r],1)  # root is degree r
            assert_equal(dh[r+1],order-r**h-1)# everyone else is degree r+1
            assert_equal(len(dh),r+2)
dataset/ETHPy150Open networkx/networkx/networkx/generators/tests/test_classic.py/TestGeneratorClassic.test_balanced_tree/swapped operands of `-`