Example #1
0
 def testTriangleFree(self):
     G = make_cycle(4)
     self.assertEqual(triangle_free(G), True)
     G = make_claw()
     self.assertEqual(triangle_free(G), True)
     G = make_co_claw()
     self.assertEqual(triangle_free(G), False)
     G = make_diamond()
     self.assertEqual(triangle_free(G), False)
Example #2
0
 def testLoad(self):
     claw = make_claw()
     c7 = make_cycle(7)
     co_claw = make_co_claw()
     tests = {"test1.txt": claw, "test2.txt": c7, "test3.txt": co_claw}
     directory = os.path.join(self.directory, "test")
     for file, expect in tests.items():
         file_obj = File(directory, file=file)
         self.assertEqual(expect.nodes(), file_obj.G.nodes(), "Load Failed Nodes: %s" % file)
         self.assertEqual(expect.edges(), file_obj.G.edges(), "Load Failed :Edges %s" % file)
Example #3
0
 def testCompare(self):
     claw = make_claw()
     co_claw = make_co_claw()
     f = File(self.directory, G=claw, logger=self.logger)
     g = File(self.directory, G=claw, logger=self.logger)
     self.assertEqual(g.compare(f), True)
     self.assertEqual(f.compare(g), True)
     g = File(self.directory, G=co_claw, logger=self.logger)
     self.assertEqual(g.compare(f), False)
     self.assertEqual(f.compare(g), False)
     h = File(self.directory, G=make_cycle(4), logger=self.logger)
     self.assertEqual(h.compare(f), False)
     self.assertEqual(f.compare(h), False)
Example #4
0
 def testC7CoClawClawFree(self):
     g = make_cycle(7)
     subgraphs = [make_claw(), make_co_claw()]
     k_vertexes = k_vertex(g, subgraphs)
     for index, k in enumerate(k_vertexes):
         if index > 0:
             self.assertEqual(k['has_k_vertex'], False,
                              '''
                              K Vertex says (claw,co-claw)-free Graph 
                              has a %s-vertex'''  % index)
         else:
             self.assertEqual(k['has_k_vertex'], True,
                              '''
                              K Vertex says (claw,co-claw)-free Graph 
                              has no a %s-vertex'''  % index)
Example #5
0
from os.path import join
from utility.generator import Generator2
from utility.file import File
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__)