Ejemplo n.º 1
0
 def testCreateSubdivision(self):
     # test one zero paths and 1 path$
     g = ISK4Free(make_co_twin_c5())
     result = g.create_subdivions([0,0,0,0,0,0])
     self.assertEqual(self.compare_graphs(result, make_clique(4)), True)
     result = g.create_subdivions([1,0,0,0,0,0])
     expect = make_clique(4)
     expect.remove_edge(2, 3)
     expect.add_node(4)
     expect.add_edge(2,4)
     expect.add_edge(3,4)
     self.assertEqual(self.compare_graphs(result, expect), True)
Ejemplo n.º 2
0
 def testFree(self):
     # simple case
     g = ISK4Free(make_clique(4))
     result = g.free()
     self.assertEqual(self.compare_graphs(result, make_clique(4)), True)
     # another simple case
     g = ISK4Free(make_co_twin_c5())
     result = g.free()
     expect = make_co_twin_c5()
     self.assertEqual(self.compare_graphs(result, expect), True)
     # difficult graph
     graph = make_cycle(5)
     graph.add_node(5)
     graph.add_edge(0, 5)
     graph.add_edge(1, 5)
     graph.add_edge(3, 5)
     g = ISK4Free(graph)
     result = g.free()
     self.assertEqual(self.compare_graphs(result, graph), True)
     # one with no ISK4
     graph = make_cycle(6)
     g = ISK4Free(graph)
     result = g.free()
     self.assertEqual(result, None)
Ejemplo n.º 3
0
from utility.file import File
from utility.generator import Generator
from graph.helper import make_cycle, make_clique, make_co_twin_c5
import logging
from os.path import join
from os import getcwd

# constants
REQUIREMENT = 4

logging.basicConfig(filename="d3_set_conjecture.log", level=logging.INFO,
                            format='%(asctime)s %(message)s')
LOGGER = logging.getLogger(__name__)

DROPS  = 10
FORBIDDEN = [make_clique(4), make_co_twin_c5(),make_cycle(4), make_cycle(6), make_cycle(8)]
MYPATH = join(getcwd(), "counter_example", "d3" )
GRAPH = make_cycle(5)

def go():
    print("Two v d(v1) <= d(v2) < 4")
    count = 0
    for g in Generator(GRAPH, DROPS, FORBIDDEN, logger=LOGGER).iterate():
        count += 1
        if not conjecture_holds(g):
            f = File(MYPATH, G=g, logger=LOGGER, base="")
            fp = f.save()
            LOGGER.info("Found the special graph")
            print("Found the special graph")
        if count % 1000 == 0:
            print("Checked {} graphs".format(count))