def CliqueNumEqualsChromaticNum(G): result = False if (graph_clique_number(G) == chromatic_number(G)): result = True return result
def ChromaticNumberEqualsCLiqueNumber(G): if(chromatic_number(G) == graph_clique_number(G)): result = True else: result = False return result
def TheAlgorithm(G): dColor = Dcolor(G) partialColoring = list() #Compute chi(G) (using brute force) k = len(dColor.color()) hasStrongStableSet = False thisStableSet = FindStrongStableSet(G) if thisStableSet != None: hasStrongStableSet = True while hasStrongStableSet: #thisStableSet = FindStrongStableSet(G) partialColoring.append(list(thisStableSet)) #Remove this stable set from the graph for thisStableVertex in thisStableSet: G.remove_node(thisStableVertex) thisStableSet = FindStrongStableSet(G) if thisStableSet == None: hasStrongStableSet = False #check for induced C7 graphToTest = convert_node_labels_to_integers(G, 0, ordering='default', label_attribute = None) if induced_subgraph(graphToTest, make_cycle(CYCLE_LENGTH)) == None: stillHasInducedC7 = False else: stillHasInducedC7 = True graphToTest.clear() while stillHasInducedC7 == True: thisStableSet = FindSimpleStableSet(G) partialColoring.append(thisStableSet) for thisStableVertex in thisStableSet: G.remove_node(thisStableVertex) graphToTest = convert_node_labels_to_integers(G, 0, ordering='default', label_attribute = None) if induced_subgraph(graphToTest, make_cycle(CYCLE_LENGTH)) == None: stillHasInducedC7 = False graphToTest.clear() """ At this point, there does not exist a strong stable set of size 3, because there is no C7. This means that G is now a perfect graph. """ t = chromatic_number(G) #Find the chromatic number of our partial graph of stable sets s = len(partialColoring) if k == (s + t): result = True else: result = False return result
def HoangConjecture(G): V = G.nodes() chi = ceil(len(V)/3) if chi == chromatic_number(G): result = True else: result = False return result
def is_critical(self): ''' a method that finds if the graph is is_critical Parameters: None Returns: True if graph is is_critical False otherwise ''' is_critical = True nodes = self._g.nodes() index = 0 chromatic = chromatic_number(self._g) self.logger.info("Chromatic number of G is %d" %chromatic) while is_critical and index < len(nodes): g = self._g.copy() g.remove_node(nodes[index]) check = chromatic_number(g) if check != (chromatic -1): self.logger.info(index) self.logger.info("G is not critical") is_critical = False index += 1 return is_critical