Ejemplo n.º 1
0
 def testInducedSubgraph(self):
     h = helper.make_claw()
     g = helper.make_wheel(7)
     induced = induced_subgraph(g, h)
     expected = [0, 2, 4, 6] 
     self.assertEqual(induced.nodes(), expected,
                      "Contains: Failed to find a claw in W7")
Ejemplo n.º 2
0
def go():
    forbidden = [make_kite(),
                 make_cycle(4),
                 make_cycle(6),
                 make_cycle(8),
                 make_wheel(6)]
    g = make_cycle(5)
    check_graph(DROPS, g, forbidden)
    return
Ejemplo n.º 3
0
def go():
    forbidden = [make_co_cricket(),
                 make_cycle(4),
                 make_cycle(6),
                 make_cycle(8),
                 make_wheel(6)]
    g = make_cycle(7)
    check_graph(DROPS, g, forbidden)
    return
Ejemplo n.º 4
0
sys.path.append("..") # Adds higher directory to python modules path.
from graph.helper import make_cycle, make_kite, make_clique, make_wheel
from utility.file import File
from graph import DalGraph
import os
from utility.generator import Generator
import logging
from pprint import PrettyPrinter
pp = PrettyPrinter(indent = 4)

FORBIDDEN =  [make_kite(),
              make_cycle(4),
              make_cycle(6),
              make_cycle(8),
              make_cycle(5),
              make_wheel(6)
              ]
BASE = "C5"
DIRECTORY=os.path.join(os.getcwd(), "Critical-graphs", BASE)
STARTING = make_cycle(5)
logging.basicConfig(filename=BASE+"finding_critical.log", level=logging.INFO,
                            format='%(asctime)s %(message)s')
LOGGER = logging.getLogger(__name__)
DROPS = 5

def go():
    gen = Generator(STARTING, DROPS, FORBIDDEN, logger=LOGGER)
    total = gen.total_graphs()
    i = 0
    for g in gen.iterate():
        i +=1