Skip to content

Instantly share code, notes, and snippets.

@davidrajm
Created November 21, 2024 14:07
Show Gist options
  • Save davidrajm/e978c9cfe857a82e97a8952675c10be6 to your computer and use it in GitHub Desktop.
Save davidrajm/e978c9cfe857a82e97a8952675c10be6 to your computer and use it in GitHub Desktop.
import random
def generate_city_transport_network(num_stations=10, num_routes=15):
stations = [f"Station_{i}" for i in range(num_stations)]
routes = []
for _ in range(num_routes):
station1, station2 = random.sample(stations, 2)
routes.append((station1, station2))
return stations, routes
if __name__ == "__main__":
stations, routes = generate_city_transport_network()
print("Stations:")
print(stations)
print("\nRoutes:")
print(routes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment