Add bus network
This commit is contained in:
parent
f463cfd6ce
commit
c8db7c9940
@ -70,6 +70,15 @@ def do_graph_animation(output_file_name: str, in_graph: Graph, frame_count: int)
|
|||||||
plt.show()
|
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():
|
def main():
|
||||||
network = Graph()
|
network = Graph()
|
||||||
nodes = [Node(True), Node(), Node(), Node(True), Node()]
|
nodes = [Node(True), Node(), Node(), Node(True), Node()]
|
||||||
@ -85,6 +94,9 @@ def main():
|
|||||||
|
|
||||||
do_graph_animation('test.gif', network, 5)
|
do_graph_animation('test.gif', network, 5)
|
||||||
|
|
||||||
|
bus = bus_network()
|
||||||
|
do_graph_animation('bus.gif', bus, 5)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user