def testC5DiamondCoDiamondFree(self): g = make_cycle(5) subgraphs = [make_diamond(), make_co_diamond()] k_vertexes = k_vertex(g, subgraphs) expect = [False, False, True, True, False, False] for index, k in enumerate(k_vertexes): self.assertEqual(k['has_k_vertex'], expect[index], '''K Vertex says (diamond,co-diamond)- free Graph %d - vertex:%r but should be %r''' %(index, k['has_k_vertex'], expect[index])) set_2_vertex = [(0, 1), (0, 4), (1, 2), (2, 3), (3, 4)] for check in set_2_vertex: self.assertEqual(check in k_vertexes[2]['combinations'], True, ''' K vertex missing 2 Vertex set (%d, %d) on (diamond, co-diamond)-free Grpah ''' %(check[0],check[1])) set_3_vertex = [(0, 1, 3), (0, 2, 3), (0, 2, 4), (1, 2, 4), (1, 3, 4)] for check in set_3_vertex: self.assertEqual(check in k_vertexes[3]['combinations'], True, ''' K vertex missing 3 Vertex set (%d, %d, %d) on (diamond, co-diamond)-free Grpah ''' %(check[0],check[1], check[2]))
import logging from utility.EmailHelper import send_email TO_ADDRESS = "*****@*****.**" CREATE_MESSAGE = "Create Graphs was completed" # create forbidden graph c4 = make_cycle(4) c6 = make_cycle(6) c8 = make_cycle(8) c10 = make_cycle(10) k4 = make_clique(4) coclaw = make_co_claw() k2 = make_2K2() cok4 = make_cok4() codiamond = make_co_diamond() # these constants are what should change FAMILY = "Even-Hole" DIRECTORY = join(getcwd(), 'GraphFamilies', FAMILY) FORBIDDEN = [c4, c6, c8, c10, k4] STARTING = make_co_cycle(5) BASE = "C5" logging.basicConfig( filename=BASE + FAMILY + ".log", level=logging.INFO, format='%(asctime)s %(message)s') LOGGER = logging.getLogger(__name__) # processing work generator = Generator2(STARTING, 5, FORBIDDEN) index = 0