Skip to content

TEAM-IMT/zombies-spread-dynamics

Repository files navigation

Zombies Spread Dynamics

Contributors Forks Stargazers Issues MIT License


Logo

Zombie Spread Dynamics

Simulation of the spread of a zombie epidemic in Europe, based on the modeling of the territory with graph theory, in order to take control measures with military troops and nuclear bombs to save the largest possible population.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

We find ourselves in an apocalyptic world plagued by zombies, whose origin happened on August 18, 2019 in the city of Rize, Turkey. According to studies, the dynamics of zombie behavior has been modeled based on the geography of the terrain and the surrounding human population density. For this, digital image processing and graph theory techniques are used to transform maps of the European continent into a graph, with population information at each node.

Subsequently, the implementation of the dynamics is carried out, creating maps that simulate the propagation. Finally, 2 epidemic control action measures are executed, which involve the deployment of military troops and nuclear bombs, affecting the behavior of specific nodes in the network. All this in order to save as much of the remaining population as possible!

For more information, you can see the description of the project.

Built With

Getting Started

To get a local copy just executed the following command: Activate environment

git clone https://github.com/TEAM-IMT/zombies-spread-dynamics.git

Prerequisites

Install all the requerements:

pip3 -m install -U -r requerements.txt

Usage

The project was developed in three parts:

  1. Modeling of the graph through geographic images of Europe.
  2. Propagation dynamics implementation
  3. Execution of set of actions (military troops and nuclear bombs)

The development of all the steps are consigned in our main notebook. For the dynamics step, we implemented a python library that allows to execute the propagation step by step. To use it, we must import the library and create an object of type spread_zombie_dynamics. This will require to previously define the network configuration to be used and the propagation start date. As a test, you can use a grid defined in the same library:

from libraries.dynamics import spread_zombie_dynamics as szd
from libraries.dynamics import graph_by_default
import datetime as dt
import tqdm

G = graph_by_default(nodes = 20)
ini_date = dt.datetime(year = 2019, month = 8, day = 18)
dynamic = szd(graph = G, INTIAL_DATE = ini_date)
  • Note: The nodes and edges of the network must contain certain attributes. You can check which ones in the library information.

To run through a cycle of the simulation, just execute the step() method, this will propagate the initial zombies to their neighboring cells and perform the interactions between zombies and humans according to the propagation rules. Thus, the command allows iterative execution of the algorithm:

for epoch in tqdm.tqdm(range(20)): # Just 20 epochs
    dynamic.step() # Run one step in dynamic procedure
    print(dynamic) # See basic statistics at each iteration

You can see how the graph changes through the simulation from different functions.

kind_plot = 'evolution' # Change the word in order to get a different plot
graph_type = 'both' # Available types: ['zombie','human', 'both']
for epoch in tqdm.tqdm(range(20)): # Just 20 epochs
    dynamic.step() # Run one step in dynamic procedure
    dynamic.plot_zombie_age() # Zombies evolution by age
    if kind_plot == 'evolution':
        dynamic.plot_evolution() # Zombies and human evolution
    elif kind_plot == 'graph':
        dynamic.plot_graph(type = graph_type) # Graph evolution
    elif kind_plot == 'all':
        dynamic.plot_all(type = graph_type) # Population + Graph evolution
    print(dynamic) # See basic statistics at each iteration
plt.show()
  • Note: For complex networks with more than 400 total nodes, these simulations can be computationally expensive. It is recommended to update the graph every few iterations.

For more information, use the help command to view the library documentation. Moreover, you can see the results obtained in the project in the final report.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Acknowledgements

About

Simulation of zombie epidemic using graph theory

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published