예제 #1
0
 def setUpClass(cls):
     url = urllib.parse.urlparse(CAIDA_AS_RELATIONSHIPS_URL)
     db_filename = os.path.basename(url.path)
     db_filepath = os.path.join("tests", db_filename)
     if not os.path.exists(db_filepath):
         urllib.request.urlretrieve(CAIDA_AS_RELATIONSHIPS_URL, db_filepath)
     cls.graph = ASGraph.read_caida_asrel_graph(db_filepath)
예제 #2
0
def bench():
    url = urllib.parse.urlparse(CAIDA_AS_RELATIONSHIPS_URL)
    db_filename = os.path.basename(url.path)
    db_filepath = os.path.join("tests", db_filename)
    if not os.path.exists(db_filepath):
        urllib.request.urlretrieve(CAIDA_AS_RELATIONSHIPS_URL, db_filepath)
    graph = ASGraph.read_caida_asrel_graph(db_filepath)

    t = timeit.Timer(lambda: random_inference(graph))
    print(t.repeat(repeat=5, number=32))