SNACS is a research project aimed at detecting anomalies in social networks using graph-based techniques. The project includes implementations of CADA and Oddball algorithms, tools for generating synthetic datasets, and applications to real-world data like the Enron email dataset.
-
CADA.py
- Contains the implementation of the CADA (Contrastive Anomaly Detection in Attributed Networks) method.
- Can be found in Helper/CADA-original-code/ in notebook format.
-
Oddball.py
- Contains the Oddball algorithm implementation for anomaly detection in graphs.
- Can be found in Helper/Oddball-original-code/ in notebook format.
-
DataGenerationAnomaly/
- Includes
datagenerator.py, which generates synthetic graph datasets for testing anomaly detection algorithms. - Includes
LFR.py, which also generates synthetic graphs for testing, but instead of being truly random, it has a community based structure which resembles real-world datasets much more. Anomalies have been injected using the Replaced Anomaly method mentioned in the CADA paper (source).
- Includes
-
Datasets/
- Com2Cand/: Dataset used for experiments.
- Enron-Dataset/: Contains the Enron email dataset (source).
-
GeneratedData/
- Contains synthetic test datasets generated using
datagenerator.py. - Files include node-edge relationships and labels for normal and anomalous nodes.
- Contains synthetic test datasets generated using
git clone https://github.com/Remmie0/SNACS.git
cd SNACS
This project requires Python 3.8+. However, we implemented GPU support for NetworkX and Oddball specifically and need Python 3.12+. This can be disabled by commenting out the NETWORKX_BACKEND_PRIORITY in the main files. Recreating the environment will automatically use Python 3.12.8
It is advised to recreate our environment using conda with the following command and the included yml file. This has the highest chance of working out of the box.
conda env create -f environment.yml
A requirements.txt is also provided, but it might not work out of the box as some packages used were conda specific from the rapidai library, can be installed with the following command.
pip install -r requirements.txt
python main.py
All testing and coding have been done on a workstation with the following OS and hardware:
-
OS: Ubuntu 24.04
-
CPU: Ryzen 9 7950x 16 core - 32 thread CPU
-
GPU: RTX 3080
-
RAM: 64GB DDR5 5600Mhz
-
SSD: Samsung 980 Pro
-
Python 3.12.8 (see yml for exact virtual environment used, cuda might not work out of the box with older GPU's, but the code will run (on CPU))