Add bus network

This commit is contained in:
Marcin Kostrzewski 2022-06-16 20:44:58 +02:00
parent f463cfd6ce
commit c8db7c9940

View File

@ -70,6 +70,15 @@ def do_graph_animation(output_file_name: str, in_graph: Graph, frame_count: int)
plt.show()
def bus_network(n=30) -> Graph:
network = Graph()
nodes = [Node() for _ in range(n)]
edges = [Edge(nodes[i], nodes[i+1], 1.0) for i in range(n-1)]
network.add_edges(edges)
return network
def main():
network = Graph()
nodes = [Node(True), Node(), Node(), Node(True), Node()]
@ -85,6 +94,9 @@ def main():
do_graph_animation('test.gif', network, 5)
bus = bus_network()
do_graph_animation('bus.gif', bus, 5)
if __name__ == "__main__":
main()