Giter Site home page Giter Site logo

safreita1 / tiger Goto Github PK

View Code? Open in Web Editor NEW
151.0 4.0 23.0 23.19 MB

Python toolbox to evaluate graph vulnerability and robustness (CIKM 2021)

Home Page: https://graph-tiger.readthedocs.io

License: MIT License

Python 100.00%
graph robustness vulnerability attack defense simulation cascading-failures diffusion networks epidemics

tiger's Introduction

Run Python Tests Version Python 3 Python 3 Documentation Status License: MIT arXiv

TIGER Library

TIGER is a Python toolbox to conduct graph vulnerability and robustness research. TIGER contains numerous state-of-the-art methods to help users conduct graph vulnerability and robustness analysis on graph structured data. Specifically, TIGER helps users:

  1. Quantify network vulnerability and robustness,
  2. Simulate a variety of network attacks, cascading failures and spread of dissemination of entities
  3. Augment a network's structure to resist attacks and recover from failure
  4. Regulate the dissemination of entities on a network (e.g., viruses, propaganda).

For additional information, take a look at the Documentation and our paper:

Evaluating Graph Vulnerability and Robustness using TIGER. Scott Freitas, Diyi Yang, Srijan Kumar, Hanghang Tong, and Duen Horng (Polo) Chau. CIKM Resource Track, 2021.


Setup

To quickly get started, install TIGER using pip

$ pip install graph-tiger

Alternatively, you can clone TIGER, create a new Anaconda environment, and install the library by running python setup.py install.

To verify that everything works as expected, you can run the tests cases using python -m pytest tests/.


Tutorials

We provide 5 in-depth tutorials in the Documentation, each covers a core aspect of TIGER's functionality.

Tutorial 1: Measuring Graph Vulnerability and Robustness

Tutorial 2: Attacking a Network

Tutorial 3: Defending A Network

Tutorial 4: Simulating Cascading Failures on Networks

Tutorial 5: Simulating Entity Dissemination on Networks


Citing

If you find TIGER useful in your research, please consider citing the following paper:

@article{freitas2021evaluating,
    title={Evaluating Graph Vulnerability and Robustness using TIGER},
    author={Freitas, Scott and Yang, Diyi and Kumar, Srijan and Tong, Hanghang and Chau, Duen Horng},
    journal={ACM International Conference on Information and Knowledge Management},
    year={2021}
}

Quick Examples

EX 1. Calculate graph robustness (e.g., spectral radius, effective resistance)

from graph_tiger.measures import run_measure
from graph_tiger.graphs import graph_loader

graph = graph_loader(graph_type='BA', n=1000, seed=1)

spectral_radius = run_measure(graph, measure='spectral_radius')
print("Spectral radius:", spectral_radius)

effective_resistance = run_measure(graph, measure='effective_resistance')
print("Effective resistance:", effective_resistance)

EX 2. Run a cascading failure simulation on a Barabasi Albert graph

from graph_tiger.cascading import Cascading
from graph_tiger.graphs import graph_loader

graph = graph_loader('BA', n=400, seed=1)

params = {
    'runs': 1,
    'steps': 100,
    'seed': 1,

    'l': 0.8,
    'r': 0.2,
    'c': int(0.1 * len(graph)),

    'k_a': 30,
    'attack': 'rb_node',
    'attack_approx': int(0.1 * len(graph)),

    'k_d': 0,
    'defense': None,

    'robust_measure': 'largest_connected_component',

    'plot_transition': True,  # False turns off key simulation image "snapshots"
    'gif_animation': False,  # True creaets a video of the simulation (MP4 file)
    'gif_snaps': False,  # True saves each frame of the simulation as an image

    'edge_style': 'bundled',
    'node_style': 'force_atlas',
    'fa_iter': 2000,
}

cascading = Cascading(graph, **params)
results = cascading.run_simulation()

cascading.plot_results(results)
Step 0: Network pre-attack Step 6: Beginning of cascading failure Step 99: Collapse of network

EX 3. Run an SIS virus simulation on a Barabasi Albert graph

from graph_tiger.diffusion import Diffusion
from graph_tiger.graphs import graph_loader

graph = graph_loader('BA', n=400, seed=1)


sis_params = {
    'model': 'SIS',
    'b': 0.001,
    'd': 0.01,
    'c': 1,

    'runs': 1,
    'steps': 5000,
    'seed': 1,

    'diffusion': 'min',
    'method': 'ns_node',
    'k': 5,

    'plot_transition': True,
    'gif_animation': False,

    'edge_style': 'bundled',
    'node_style': 'force_atlas',
    'fa_iter': 2000
}

diffusion = Diffusion(graph, **sis_params)
results = diffusion.run_simulation()

diffusion.plot_results(results)
Step 0: Virus infected network Step 80: Partially infected network Step 4999: Virus contained

Techniques Implemented

Vulnerability and Robustness Measures:

Attack Strategies:

Defense Strategies:

Simulation Frameworks:


License

MIT License

tiger's People

Contributors

safreita1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tiger's Issues

Pip install issue with bezier

Facing an issue with installing graph_tiger because of dependency on bezier package. The error has been posted below

Collecting graph-tiger
  Using cached graph-tiger-0.1.4.tar.gz (30 kB)
  Using cached graph-tiger-0.1.3.tar.gz (27 kB)
ERROR: Cannot install graph-tiger==0.1.3, graph-tiger==0.1.4 and graph-tiger==0.1.5 because these package versions have conflicting dependencies.

The conflict is caused by:
    graph-tiger 0.1.5 depends on bezier==2020.5.19
    graph-tiger 0.1.4 depends on bezier==2020.5.19
    graph-tiger 0.1.3 depends on bezier==2020.5.19

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

What can I do here, could you please help.

ModuleNotFoundError: No module named 'fa2'

os: Ubuntu 18.04.5
pip install graph-tiger

......
Successfully built graph-tiger
Installing collected packages: graph-tiger
Successfully installed graph-tiger-0.2.5
Note: you may need to restart the kernel to use updated packages.

but

import graph_tiger.cascading as CF

ModuleNotFoundError: No module named 'fa2'

then

pip install fa2

Failed to build fa2
ERROR: Could not build wheels for fa2, which is required to install pyproject.toml-based projects
Note: you may need to restart the kernel to use updated packages.

Add ffmpeg dependency

Need to add conda dependency on ffmpeg for simulation animations to save properly.

NotADirectoryError: [WinError 267]

I tried to attack(), but I got this error:


NotADirectoryError Traceback (most recent call last)
in
----> 1 a=Attack(UG)

~\anaconda3\lib\site-packages\graph_tiger\attacks.py in init(self, graph, runs, steps, attack, defense, k_d, **kwargs)
450
451 self.save_dir = os.path.join(os.getcwd(), 'plots', self.get_plot_title(steps))
--> 452 os.makedirs(self.save_dir, exist_ok=True)
453
454 self.attacked = []

~\anaconda3\lib\os.py in makedirs(name, mode, exist_ok)
221 return
222 try:
--> 223 mkdir(name, mode)
224 except OSError:
225 # Cannot rely on checking for EEXIST, since the operating system

NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\Users\29369\plots\Attack:step=50,attack=id_node,k_d=0,defense=None


how can I fix this? Really need your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.