예제 #1
0
from performance import Performance
from goody import irange
from graph_goody import random_graph,spanning_tree

# Put script below to generate data for Problem #1
# In case you fail, the data appears in sample8.pdf in the helper folder
for i in range(8):
    size=(2**i)*1000
    g=random_graph(size,lambda x:x*10)
    p=Performance(lambda :spanning_tree(g),lambda :None,5,'\n\nSpanning Tree of size ' + str(size))
    p.evaluate()
    p.analyze()
예제 #2
0
from performance import Performance
from goody import irange
from graph_goody import random, spanning_tree

# Put script here to generate data for Problem #1
g = None

def create_random(n):
    global g
    g = random(n, lambda n : 10*n) 
    
for i in irange(0,7) :
    n = 1000 * 2**i
    p = Performance(lambda : spanning_tree(g), lambda : create_random(n),5,'Spanning Tree of size {}'.format(n))
    p.evaluate()
    p.analyze()
    print()
예제 #3
0
def span_time(n):
    global rand_graph 
    spanning_tree(rand_graph)
예제 #4
0
from performance import Performance
from goody import irange
from graph_goody import random_graph,spanning_tree
from graph import Graph

# Put script below to generate data for Problem #1
# In case you fail, the data appears in sample8.pdf in the helper folder
global nodes
global graph
if __name__ == '__main__':
    nodes = 1000
    while nodes <= 128000:
        graph = random_graph(nodes,lambda n : 10*n)
        perf = Performance(lambda: spanning_tree(graph),setup=lambda:None,times_to_measure=5,title='Spanning Tree Timings for '+str(nodes)+' nodes')
        perf.evaluate()
        perf.analyze()
        nodes *= 2
예제 #5
0
 def spamming_tree():
     return spanning_tree(create_random())
예제 #6
0
from performance import Performance
from goody import irange
from graph_goody import random, spanning_tree

# Put script here to generate data for Problem #1
def create_random():
    global dog
    dog = random(x*1000, lambda n : 10*n)



if __name__ == '__main__':
    x=1
    while x<129:
        y = Performance(lambda:spanning_tree(dog), lambda:create_random(), title = "Spanning Tree of Size " + str(x*1000))
        y.evaluate()
        y.analyze()
        print()
        x = 2*x
예제 #7
0
from performance import Performance
from goody import irange
from graph_goody import random_graph, spanning_tree

# Put script here to generate data for Problem #1
# In case you fail, the data appears in sample8.pdf in the helper folder


def creat_random(n):
    global correct_size
    correct_size = random_graph(n, lambda n: n * 10)


for i in irange(0, 7):
    n = 1000
    n = n * (2**i)
    p = Performance(lambda: spanning_tree(correct_size),
                    lambda: creat_random(n),
                    5,
                    title='Spanning Tree of size {}'.format(n))
    p.evaluate()
    p.analyze()
    print()
예제 #8
0
from performance import Performance
from graph_goody import random_graph, spanning_tree

# Put script below to generate data for Problem #1
# In case you fail, the data appears in sample8.pdf in the helper folder


def create_random(size: int) -> 'Graph':
    return random_graph(size, lambda n: 10 * n)


graph = None

size = 1
while size <= 128:
    graph = create_random(size * 1000)
    p = Performance(lambda: spanning_tree(graph),
                    title=f'Spanning Tree of size {size*1000}')
    p.evaluate()
    p.analyze()
    print()
    size *= 2
예제 #9
0
from performance import Performance
from goody import irange
from graph_goody import random_graph,spanning_tree
# Put script below to generate data for Problem #1
# In case you fail, the data appears in sample8.pdf in the helper folder
def create_random(i):
    global graph
    graph = random_graph(i, lambda n : 10*n)

for i in irange(0,7):
    p = Performance(lambda : spanning_tree(graph), lambda: create_random(2**i * 1000), 5, f'\nSpanning Tree of size {2**i *1000}')
    p.evaluate()
    p.analyze()