def infect_and_return_num_bad_edges(graph, numToInfect): infecter = Infecter() start = random.choice(graph.users) infecter.infect_limited_from(start, numToInfect) return infecter.get_solution_quality(graph.users)
def test_infect_limited_from(): graph = CoachingGraph() graph.init_semi_random_connected(200) numToInfect = 70 users = graph.users user = random.choice(users) infecter = Infecter() infecter.infect_limited_from(user, numToInfect) numInfected = infecter.get_num_infected(users) assert numInfected == numToInfect