GraphWar: Arms Race in Graph Adversarial Learning
NOTE: GraphWar is still in the early stages and the API will likely continue to change.
๐
Installation
Please make sure you have installed PyTorch and Deep Graph Library(DGL).
# Comming soon
pip install -U graphwar
or
# Recommended
git clone https://github.com/EdisonLeeeee/GraphWar.git && cd GraphWar
pip install -e . --verbose
where -e
means "editable" mode so you don't have to reinstall every time you make changes.
Get Started
Assume that you have a dgl.DGLgraph
instance g
that describes you dataset.
A simple targeted attack
from graphwar.attack.targeted import RandomAttack
attacker = RandomAttack(g)
attacker.attack(1, num_budgets=3) # attacking target node `1` with `3` edges
attacked_g = attacker.g()
edge_flips = attacker.edge_flips()
A simple untargeted attack
from graphwar.attack.untargeted import RandomAttack
attacker = RandomAttack(g)
attacker.attack(num_budgets=0.05) # attacking the graph with 5% edges perturbations
attacked_g = attacker.g()
edge_flips = attacker.edge_flips()
Implementations
In detail, the following methods are currently implemented:
Attack
Targeted Attack
Methods | Venue |
---|---|
RandomAttack | A simple random method that chooses edges to flip randomly. |
DICEAttack | Marcin Waniek et al.
|
Nettack | Daniel Zรผgner et al.
|
FGAttack | Jinyin Chen et al.
Jinyin Chen et al. Hanjun Dai et al. |
GFAttack | Heng Chang et al.
|
IGAttack | Huijun Wu et al.
|
SGAttack | Jintang Li et al.
|
Untargeted Attack
Methods | Venue |
---|---|
RandomAttack | A simple random method that chooses edges to flip randomly |
DICEAttack | Marcin Waniek et al.
|
FGAttack | Jinyin Chen et al.
Jinyin Chen et al. Hanjun Dai et al. |
Metattack | Daniel Zรผgner et al.
|
PGD, MinmaxAttack | Kaidi Xu et al.
|
Defense
Model-Level
Methods | Venue |
---|---|
MedianGCN | Liang Chen et al.
|
RobustGCN | Dingyuan Zhu et al.
|
Data-Level
Methods | Venue |
---|---|
JaccardPurification | Huijun Wu et al.
|
More details of literatures and the official codes can be found in Awesome Graph Adversarial Learning.