Exemple #1
0
    def test_merge(self, round):
        from four_color.GraphMerger import GraphMerger
        temp = self.graph
        content = self.graph.to_json()
        g1 = MultiGraph.from_json(content)
        g2 = MultiGraph.from_json(content)

        while round > 0:
            (g, elist) = GraphMerger.single_vertex_merge(g1, g2)
            self.graph = g
            self.remove_edge_on_girth()

            if not self.edge_coloring():
                raise Exception("Can not 3 coloring the induced graph")
            assert self.graph.num_errors == 0

            self.putback_the_last_deleted_edge(True)

            if not self.bicycle_algorithm():
                failed_graph_DB.add_graph(self.graph.name,
                                          self.graph.to_json())
                raise Exception("bicycle_algorithm not work!")

            assert self.graph.num_errors == 0

            round -= 1
    def test_merge(self, round):
        from four_color.GraphMerger import GraphMerger
        temp = self.graph
        content = self.graph.to_json()
        g1 = MultiGraph.from_json(content)
        g2 = MultiGraph.from_json(content)
        
        while round > 0:
            (g, elist) = GraphMerger.single_vertex_merge(g1, g2)
            self.graph = g
            self.remove_edge_on_girth()
            
            if not self.edge_coloring():
                raise Exception("Can not 3 coloring the induced graph")
            assert self.graph.num_errors == 0

            self.putback_the_last_deleted_edge(True)

            if not self.bicycle_algorithm():
                failed_graph_DB.add_graph(self.graph.name,self.graph.to_json())
                raise Exception("bicycle_algorithm not work!")
            
            assert self.graph.num_errors == 0
            
            round -= 1
Exemple #3
0
    def test_vertex_edge_merge(self, round):
        from four_color.GraphMerger import GraphMerger
        temp = self.graph
        content = self.graph.to_json()
        g1 = MultiGraph.from_json(content)
        g2 = MultiGraph.from_json(content)
        while round > 0:
            (g, elist) = GraphMerger.single_vertex_and_edge_merge(g1, g2)

            self.graph = g

            for eid in elist:
                xx, yy = eid
                edge = self.graph.get_edge_by_endpoints(xx, yy)
                self.remove_specified_edge(edge)

                if not self.edge_coloring():
                    raise Exception("Can not 3 coloring the induced graph")
                assert self.graph.num_errors == 0

                self.putback_the_last_deleted_edge(True)

                if not self.bicycle_algorithm():
                    xxx = edge.get_endpoints()
                    print("remove: ", xxx)
                    failed_graph_DB.add_graph(self.graph.name,
                                              self.graph.to_json())
                    raise Exception("bicycle_algorithm not work!")

                assert self.graph.num_errors == 0

            round -= 1
    def test_vertex_edge_merge(self, round):
        from four_color.GraphMerger import GraphMerger
        temp = self.graph
        content = self.graph.to_json()
        g1 = MultiGraph.from_json(content)
        g2 = MultiGraph.from_json(content)
        while round > 0:
            (g, elist) = GraphMerger.single_vertex_and_edge_merge(g1, g2)
            
            self.graph = g


            for eid in elist:
                xx, yy = eid
                edge = self.graph.get_edge_by_endpoints(xx, yy)
                self.remove_specified_edge(edge)

                if not self.edge_coloring():
                    raise Exception("Can not 3 coloring the induced graph")
                assert self.graph.num_errors == 0

                self.putback_the_last_deleted_edge(True)

                if not self.bicycle_algorithm():
                    xxx = edge.get_endpoints()
                    print "remove: ", xxx
                    failed_graph_DB.add_graph(self.graph.name,self.graph.to_json())
                    raise Exception("bicycle_algorithm not work!")
                
                assert self.graph.num_errors == 0
            
            round -= 1