Skip to main content

GraphIDS

Graph-based intrusion detection using GCN, Transformer autoencoder, and contrastive learning.

Reference implementation of the framework introduced in:

Govindarajan, V. & Muzamal, J. H. (2025). Advanced cloud intrusion detection framework using graph based features transformers and contrastive learning. Scientific Reports, 15, 20511. DOI: 10.1038/s41598-025-07956-w

Install

pip install graphids

Quick start

from graphids import GraphIDS

model = GraphIDS(n_features=41, n_classes=5)
model.train_pipeline(X_train, y_train)
result = model.evaluate(X_test, y_test)
print(f"Accuracy: {result.accuracy:.4f}")

Architecture

Three-stage pipeline:

  1. GCN — constructs a communication graph from flow data, extracts structural node embeddings via 3-layer graph convolution
  2. Transformer autoencoder — refines embeddings through self-attention, identifies discriminative feature dimensions
  3. Contrastive classifier — improves class separation for minority attack types (U2R, R2L), outputs multi-class predictions

Results (from the paper)

Dataset Accuracy Precision Recall F1 FPR
NSL-KDD (5-class) 99.97% 99.94% 99.92% 99.93% 0.05%
CIC-IDS (binary) 99.96% 99.93% 99.91% 99.92% 0.06%
CIC-IDS (multi) 99.95% 99.92% 99.90% 99.91% 0.07%

Citation

@article{govindarajan2025graphids,
    title   = {Advanced cloud intrusion detection framework using graph based
               features transformers and contrastive learning},
    author  = {Govindarajan, Vijay and Muzamal, Junaid Hussain},
    journal = {Scientific Reports},
    volume  = {15},
    pages   = {20511},
    year    = {2025},
    doi     = {10.1038/s41598-025-07956-w},
}

License

MIT

Metadata

Release files for graphids 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphids 0.1.0
File Size Uploaded
graphids-0.1.0.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for graphids 0.1.0
File Interpreter ABI Platform
graphids-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / graphids-0.1.0.tar.gz

Download URL graphids-0.1.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
db63759f43cbe5361b07c54276709c9b63d4269cc8b97df55e5df6cae6eba603
BLAKE2b-256 checksum
How to use checksums
eb106d4af618da8347695c722c3e7f3f8d3b636fcbd29038b3e0121511359227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.

Transparency log

Release files / graphids-0.1.0-py3-none-any.whl

Download URL graphids-0.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46f1df024a4ac757ec6419d18dc2073213f0404bc51c243225cefb3d2745e1d5
BLAKE2b-256 checksum
How to use checksums
ad2ae3e5674c774697f9155638db5a3490481e4c2115b2d0ab3807e3beac0eb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page