Fix refactored experiments
This commit is contained in:
parent
8fe3c2bf8e
commit
6f8563f7d8
@ -201,35 +201,42 @@ def summary(average_degrees: list[float], propagation_speeds: list[float]) -> No
|
||||
plt.show()
|
||||
|
||||
|
||||
def experiment(network, avg_degree, node_count):
|
||||
def experiment(network, avg_degree, node_count, iteration):
|
||||
degrees = []
|
||||
speeds = []
|
||||
sizes = [0, 8, 15]
|
||||
for i in sizes:
|
||||
do_graph_animation(f'bus{i}.gif', network, 90, nx.spiral_layout)
|
||||
do_graph_animation(f'bus{iteration}.gif', network, 90, nx.spiral_layout)
|
||||
speeds.append(network.rounds_survived / node_count)
|
||||
degrees.append(avg_degree)
|
||||
print(f"\n{node_count} NODE BUS")
|
||||
print(f"average degree = {avg_degree}")
|
||||
print(f"propagation speed = {round(speeds[-1], 2)}")
|
||||
print(f"bus_{i} rounds survived = {network.rounds_survived + 1}")
|
||||
print(f"bus_{iteration} rounds survived = {network.rounds_survived + 1}")
|
||||
|
||||
summary(degrees, speeds)
|
||||
|
||||
|
||||
def bus_experiment():
|
||||
sizes = [0, 8, 15]
|
||||
for i in sizes:
|
||||
bus, bus_avg_degree, node_count = bus_network(20 + i)
|
||||
experiment(bus, bus_avg_degree, node_count)
|
||||
experiment(bus, bus_avg_degree, node_count, i)
|
||||
|
||||
|
||||
def ring_experiment():
|
||||
sizes = [0, 8, 15]
|
||||
for i in sizes:
|
||||
ring, ring_avg_degree, node_count = ring_network(20 + i)
|
||||
experiment(ring, ring_avg_degree, node_count)
|
||||
experiment(ring, ring_avg_degree, node_count, i)
|
||||
|
||||
|
||||
def star_experiment():
|
||||
sizes = [0, 8, 15]
|
||||
for i in sizes:
|
||||
star, star_avg_degree, node_count = star_network(cluster_count=3 + i, starsize=3 + i)
|
||||
experiment(star, star_avg_degree, node_count)
|
||||
experiment(star, star_avg_degree, node_count, i)
|
||||
|
||||
def weighted_star_experiment():
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user