def conjecture_holds(G): ''' a function that checks if the above conjecture holds Parameters: G: the graph to check (networkx) Returns: valid: True if held, False otherwise (boolean) ''' valid = True if len(coloring(G)) >= 5: valid = False return valid
# create forbidden graph k4 = make_clique(XCHROMATIC) co_k4 = complement(make_clique(4)) # these constants are what should change FAMILY = "Line(Co-K4)-free" DIRECTORY = join(getcwd(), 'GraphFamilies', FAMILY) FORBIDDEN = forbidden_line_subgraphs() + [co_k4, k4] print(FORBIDDEN) STARTING = make_cycle(7) BASE = "C5" logging.basicConfig(filename=FAMILY + BASE + ".log", level=logging.INFO, format='%(asctime)s %(message)s') LOGGER = logging.getLogger(__name__) # processing work generator = Generator2(STARTING, 10, FORBIDDEN) index = 0 print("Started") checked = 0 for graph in generator.iterate(): if len(coloring(graph, logger=LOGGER)) >= XCHROMATIC: f = File(DIRECTORY, G=graph, logger=LOGGER, base="C5-") fp = f.save() if fp is not None: index += 1 print("Created Graph: %d" % index) checked += 1 if checked % 100 == 0: print("Checked %d Graphs" % checked) LOGGER.info("Complete") print("Total Graphs Created: %d" % index)