def bfs_random_upa_graphs(): """ Implementation on random graphs of varying sizes that are generated under the undirected preferential attachment model using the BFS algorithm. Argument: None Returns: a tuple containing the result of the run and number of nodes used.""" first = provided.upa(500,5) second = provided.upa(500,20) third = provided.upa(500,80) fourth = provided.upa(500,320) print comp182.time_func(bfs, [first, 0]), "UPA(500,5)" print "Edges in graph:", edge_count(first) print comp182.time_func(bfs, [second, 0]),"UPA(500,20)" print "Edges in graph:", edge_count(second) print comp182.time_func(bfs, [third, 0]),"UPA(500,80)" print "Edges in graph:", edge_count(third) print comp182.time_func(bfs, [fourth, 0]),"UPA(500,320)" print "Edges in graph:", edge_count(fourth)
g3 = {0: {1,2,3}, 1: {0,4,5}, 2: {0,3,6}, 3: {0,2,7}, 4: {1,3,5,8}, 5: {1,4,9}, 6: {2,7,10}, 7: {3,6,8,10}, 8: {4,7,9,11}, 9: {5,8,11}, 10:{6,7,11}, 11:{8,9,10}, } result1 = bfs(g1,0) result2 = bfs(g2,0) result3 = bfs(g3,0) """ # test 2 # g4 = provided.upa(5, 5) g5 = provided.upa(500, 20) g6 = provided.upa(500, 80) g7 = provided.upa(500, 320) result4 = comp182.time_func(bfs, [g4, 0]) result5 = comp182.time_func(bfs, [g5, 0]) result6 = comp182.time_func(bfs, [g6, 0]) result7 = comp182.time_func(bfs, [g7, 0])
def random_upa_graphs(): """ Implementation on random graphs of varying sizes that are generated under the undirected preferential attachment model. Argument: None Returns: a tuple containing the result of the run and number of nodes used.""" first = provided.upa(2,2) second = provided.upa(4,2) third = provided.upa(6,2) fourth = provided.upa(8,2) fifth = provided.upa(10,2) sixth = provided.upa(12,2) print comp182.time_func(brute_force_distance, [first, 0]), "UPA(2,2)" print "Edges in graph:", edge_count(first) print comp182.time_func(brute_force_distance, [second, 0]),"UPA(4,2)" print "Edges in graph:", edge_count(second) print comp182.time_func(brute_force_distance, [third, 0]),"UPA(6,2)" print "Edges in graph:", edge_count(third) print comp182.time_func(brute_force_distance, [fourth, 0]),"UPA(8,2)" print "Edges in graph:", edge_count(fourth) print comp182.time_func(brute_force_distance, [fifth, 0]),"UPA(10,2)" print "Edges in graph:", edge_count(fifth) print comp182.time_func(brute_force_distance, [sixth, 0]),"UPA(12,2)" print "Edges in graph:", edge_count(sixth)