This is the code for our paper CoVerD: Community-based Vertex Defense against Crawling Adversaries which appeared in the proceedings of Complex Networks 2021. CoVerD is a community-based approach that protects a given target node against crawling-based attacks in a network. CoVerD surpasses global network protectors on several benchmarks, while maintaining the computation cost close to that of the local network protectors. In this repository, you find both the python implementation for CoVerD and the scripts for reproducing our experiments.
data_preprocessing.py
: Run this script seperately from the rest of the repo to prepare the dataset used bymain.py
.coverd.py
: The code for our algorithm, CoVerD. This script is used bymain.py
.attacker.py
: The local and global perturbation baselines that we have used in the paper to benchmark CoVerD. This script is used bymain.py
.utils.py
: The helper functions used througout the repository.main.py
: The main script that invokes all the processing done by the modules above. To reproduce our experiments, you have to run this script as explained below.
data/raw
: All the dataset are available from SNAP repository. The original datasets are processed usingdata_preprocessing.py
into pickled files. This data will later be used to run a defender and/or attacker on.data/defended
: The defended graphs after running all our defender baselines on the raw datasets. Onlylastfm
data is included in this repository as a sample. The other datasets can be generated by runningmain.py
on corresponding data underdata/raw
.
A sample result of our experiments in the paper for the lastfm
dataset is included under /results
directory.
The implemented attributes for calling main.py
are as follows,
--name
: The name of the dataset.--mode
: The mode of action. Possible options areattack
anddefense
.--defend
: The set of defenders to use. The implemented defenders arecoverd
,roam
,greedy
,nothing
(na"ive baseline),betweenness
,pagerank
, andmaxdeg
.--attack
: The set of attackers to use. The implemented attackers arebfs
,dfs
, andrw
(random walk).--dpath
: The path to read the data for defender.--apath
: The path to read the data for attacker.--dsave2
: The path to save the defense results in.--asave2
: The path to save the attack results in.
python main.py --mode defense --defend coverd roam nothing --name lastfm
python main.py --mode attack --attack bfs dfs --name lastfm