# kushal-jangra/btp architecture

> Architecture diagram of the GitHub repository kushal-jangra/btp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kushal-jangra/btp
- Repository: https://github.com/kushal-jangra/btp

## Overview

Logs2Graphs turns grouped log events into directed, weighted attributed graphs, then applies OCDiGCN for graph-level anomaly detection and node-level explanation. The README documents five benchmark-specific graph-generation and detection entry points; the sampled generator excerpts confirm the graph construction and adjacency-preparation stages. BGL extensions add optional semantic features and temporal experiments, while root_causal provides separate post-hoc analysis for an already-scored graph. The main scripts and several extensions were not sampled, so their internal call wiring is not inferred.

Main entry points: [`DataLoader.py`](https://github.com/kushal-jangra/btp/blob/main/DataLoader.py) (Dataset loading), [`DIGCNConv.py`](https://github.com/kushal-jangra/btp/blob/main/DIGCNConv.py) (Directed convolution), [`GetAdjacencyMatrix.py`](https://github.com/kushal-jangra/btp/blob/main/GetAdjacencyMatrix.py) (Adjacency utilities), [`run_bgl_paper_exact.py`](https://github.com/kushal-jangra/btp/blob/main/run_bgl_paper_exact.py) (BGL experiment runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_representation["Graph representation"]
  node_hdfs_gen["HDFS graphs"]
  node_hadoop_gen["Hadoop graphs"]
  node_spirit_gen["Spirit graphs"]
  node_bgl_gen["BGL graphs"]
  node_thunderbird_gen["Thunderbird graphs"]
  node_graph_data[("Graph datasets")]
  node_data_loader["Dataset loading<br/>[DataLoader.py]"]
  node_adjacency["Adjacency utilities"]
end

subgraph group_detection["Detection and explanation"]
  node_conv["Directed convolution<br/>[DIGCNConv.py]"]
  node_hdfs_main["HDFS detection<br/>[main_HDFS.py]"]
  node_hadoop_main["Hadoop detection<br/>[main_Hadoop.py]"]
  node_spirit_main["Spirit detection<br/>[main_Spirit.py]"]
  node_bgl_main["BGL detection<br/>[main_BGL.py]"]
  node_thunderbird_main["Thunderbird detection"]
end

subgraph group_bgl["BGL extensions"]
  node_enhanced_features["Enhanced features"]
  node_bgl_prepare["BGL preparation"]
  node_local_bgl["Local BGL preparation"]
  node_bgl_runner["BGL experiment runner"]
  node_temporal_runs["BGL temporal experiments"]
end

subgraph group_causal["Root-cause analysis"]
  node_causal_api["Root-cause analysis<br/>[causal_graph.py]"]
  node_causal_score["Transition scoring"]
  node_root_rank["Root and chain ranking<br/>[graph_rank.py]"]
  node_causal_viz["Causal graph rendering<br/>[visualization.py]"]
end

node_log_source["Log data"]
node_parse_group["Parse and group"]

node_log_source -->|"parse and group"| node_parse_group
node_parse_group -->|"grouped events"| node_hdfs_gen
node_parse_group -->|"grouped events"| node_hadoop_gen
node_parse_group -->|"grouped events"| node_spirit_gen
node_parse_group -->|"grouped events"| node_bgl_gen
node_parse_group -->|"grouped events"| node_thunderbird_gen
node_hdfs_gen -->|"write graphs"| node_graph_data
node_hadoop_gen -->|"write graphs"| node_graph_data
node_spirit_gen -->|"write graphs"| node_graph_data
node_bgl_gen -->|"write graphs"| node_graph_data
node_thunderbird_gen -->|"write graphs"| node_graph_data
node_graph_data -->|"load dataset"| node_data_loader
node_data_loader -->|"provide graph data"| node_hdfs_main
node_data_loader -->|"provide graph data"| node_hadoop_main
node_data_loader -->|"provide graph data"| node_spirit_main
node_data_loader -->|"provide graph data"| node_bgl_main
node_data_loader -->|"provide graph data"| node_thunderbird_main
node_hdfs_main -->|"apply model"| node_conv
node_hadoop_main -->|"apply model"| node_conv
node_spirit_main -->|"apply model"| node_conv
node_bgl_main -->|"apply model"| node_conv
node_thunderbird_main -->|"apply model"| node_conv
node_bgl_gen -->|"prepare adjacency"| node_adjacency
node_hdfs_gen -->|"prepare adjacency"| node_adjacency
node_hadoop_gen -->|"prepare adjacency"| node_adjacency
node_spirit_gen -->|"prepare adjacency"| node_adjacency
node_thunderbird_gen -->|"prepare adjacency"| node_adjacency
node_enhanced_features -.->|"build node features"| node_bgl_prepare
node_bgl_prepare -.->|"write enhanced graphs"| node_graph_data
node_local_bgl -.->|"write local graphs"| node_graph_data
node_graph_data -.->|"load BGL graphs"| node_bgl_runner
node_bgl_runner -.->|"run OCDiGCN"| node_conv
node_bgl_runner -.->|"temporal experiments"| node_temporal_runs
node_causal_api -->|"score transitions"| node_causal_score
node_causal_api -->|"rank roots"| node_root_rank
node_causal_api -->|"render result"| node_causal_viz
node_bgl_runner -.->|"anomalous graph and importance"| node_causal_api

click node_hdfs_gen "https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_HDFS.py"
click node_hadoop_gen "https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_Hadoop.py"
click node_spirit_gen "https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_Spirit.py"
click node_bgl_gen "https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_BGL.py"
click node_thunderbird_gen "https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_Thunderbird.py"
click node_data_loader "https://github.com/kushal-jangra/btp/blob/main/DataLoader.py"
click node_adjacency "https://github.com/kushal-jangra/btp/blob/main/GetAdjacencyMatrix.py"
click node_conv "https://github.com/kushal-jangra/btp/blob/main/DIGCNConv.py"
click node_hdfs_main "https://github.com/kushal-jangra/btp/blob/main/main_HDFS.py"
click node_hadoop_main "https://github.com/kushal-jangra/btp/blob/main/main_Hadoop.py"
click node_spirit_main "https://github.com/kushal-jangra/btp/blob/main/main_Spirit.py"
click node_bgl_main "https://github.com/kushal-jangra/btp/blob/main/main_BGL.py"
click node_thunderbird_main "https://github.com/kushal-jangra/btp/blob/main/main_Thunderbird.py"
click node_enhanced_features "https://github.com/kushal-jangra/btp/blob/main/enhanced_node_builder.py"
click node_bgl_prepare "https://github.com/kushal-jangra/btp/blob/main/prepare_bgl_paper_dataset.py"
click node_local_bgl "https://github.com/kushal-jangra/btp/blob/main/prepare_local_enhanced_bgl.py"
click node_bgl_runner "https://github.com/kushal-jangra/btp/blob/main/run_bgl_paper_exact.py"
click node_causal_api "https://github.com/kushal-jangra/btp/blob/main/root_causal/causal_graph.py"
click node_causal_score "https://github.com/kushal-jangra/btp/blob/main/root_causal/causal_inference.py"
click node_root_rank "https://github.com/kushal-jangra/btp/blob/main/root_causal/graph_rank.py"
click node_causal_viz "https://github.com/kushal-jangra/btp/blob/main/root_causal/visualization.py"
click node_temporal_runs "https://github.com/kushal-jangra/btp/blob/main/run_bgl_temporal_final.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hdfs_gen,node_hadoop_gen,node_spirit_gen,node_bgl_gen,node_thunderbird_gen,node_graph_data,node_data_loader,node_adjacency toneBlue
class node_conv,node_hdfs_main,node_hadoop_main,node_spirit_main,node_bgl_main,node_thunderbird_main toneAmber
class node_enhanced_features,node_bgl_prepare,node_local_bgl,node_bgl_runner,node_temporal_runs toneMint
class node_causal_api,node_causal_score,node_root_rank,node_causal_viz toneRose
class node_log_source,node_parse_group toneIndigo
```

## Components

### Graph representation

- [HDFS graphs](https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_HDFS.py): `GraphGeneration_HDFS.py`
- [Hadoop graphs](https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_Hadoop.py): `GraphGeneration_Hadoop.py`
- [Spirit graphs](https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_Spirit.py): `GraphGeneration_Spirit.py`
- [BGL graphs](https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_BGL.py): `GraphGeneration_BGL.py`
- [Thunderbird graphs](https://github.com/kushal-jangra/btp/blob/main/GraphGeneration_Thunderbird.py): `GraphGeneration_Thunderbird.py`
- **Graph datasets**
- [Dataset loading](https://github.com/kushal-jangra/btp/blob/main/DataLoader.py): `DataLoader.py`
- [Adjacency utilities](https://github.com/kushal-jangra/btp/blob/main/GetAdjacencyMatrix.py): `GetAdjacencyMatrix.py`

### Detection and explanation

- [Directed convolution](https://github.com/kushal-jangra/btp/blob/main/DIGCNConv.py): `DIGCNConv.py`
- [HDFS detection](https://github.com/kushal-jangra/btp/blob/main/main_HDFS.py): `main_HDFS.py`
- [Hadoop detection](https://github.com/kushal-jangra/btp/blob/main/main_Hadoop.py): `main_Hadoop.py`
- [Spirit detection](https://github.com/kushal-jangra/btp/blob/main/main_Spirit.py): `main_Spirit.py`
- [BGL detection](https://github.com/kushal-jangra/btp/blob/main/main_BGL.py): `main_BGL.py`
- [Thunderbird detection](https://github.com/kushal-jangra/btp/blob/main/main_Thunderbird.py): `main_Thunderbird.py`

### BGL extensions

- [Enhanced features](https://github.com/kushal-jangra/btp/blob/main/enhanced_node_builder.py): `enhanced_node_builder.py`
- [BGL preparation](https://github.com/kushal-jangra/btp/blob/main/prepare_bgl_paper_dataset.py): `prepare_bgl_paper_dataset.py`
- [Local BGL preparation](https://github.com/kushal-jangra/btp/blob/main/prepare_local_enhanced_bgl.py): `prepare_local_enhanced_bgl.py`
- [BGL experiment runner](https://github.com/kushal-jangra/btp/blob/main/run_bgl_paper_exact.py): `run_bgl_paper_exact.py`
- [BGL temporal experiments](https://github.com/kushal-jangra/btp/blob/main/run_bgl_temporal_final.py): `run_bgl_temporal_final.py`

### Root-cause analysis

- [Root-cause analysis](https://github.com/kushal-jangra/btp/blob/main/root_causal/causal_graph.py): `root_causal/causal_graph.py`
- [Transition scoring](https://github.com/kushal-jangra/btp/blob/main/root_causal/causal_inference.py): `root_causal/causal_inference.py`
- [Root and chain ranking](https://github.com/kushal-jangra/btp/blob/main/root_causal/graph_rank.py): `root_causal/graph_rank.py`
- [Causal graph rendering](https://github.com/kushal-jangra/btp/blob/main/root_causal/visualization.py): `root_causal/visualization.py`

### Other components

- **Log data**
- **Parse and group**

## Connections

- Log data → Parse and group: parse and group
- Parse and group → HDFS graphs: grouped events
- Parse and group → Hadoop graphs: grouped events
- Parse and group → Spirit graphs: grouped events
- Parse and group → BGL graphs: grouped events
- Parse and group → Thunderbird graphs: grouped events
- HDFS graphs → Graph datasets: write graphs
- Hadoop graphs → Graph datasets: write graphs
- Spirit graphs → Graph datasets: write graphs
- BGL graphs → Graph datasets: write graphs
- Thunderbird graphs → Graph datasets: write graphs
- Graph datasets → Dataset loading: load dataset
- Dataset loading → HDFS detection: provide graph data
- Dataset loading → Hadoop detection: provide graph data
- Dataset loading → Spirit detection: provide graph data
- Dataset loading → BGL detection: provide graph data
- Dataset loading → Thunderbird detection: provide graph data
- HDFS detection → Directed convolution: apply model
- Hadoop detection → Directed convolution: apply model
- Spirit detection → Directed convolution: apply model
- BGL detection → Directed convolution: apply model
- Thunderbird detection → Directed convolution: apply model
- BGL graphs → Adjacency utilities: prepare adjacency
- HDFS graphs → Adjacency utilities: prepare adjacency
- Hadoop graphs → Adjacency utilities: prepare adjacency
- Spirit graphs → Adjacency utilities: prepare adjacency
- Thunderbird graphs → Adjacency utilities: prepare adjacency
- Enhanced features → BGL preparation: build node features
- BGL preparation → Graph datasets: write enhanced graphs
- Local BGL preparation → Graph datasets: write local graphs
- Graph datasets → BGL experiment runner: load BGL graphs
- BGL experiment runner → Directed convolution: run OCDiGCN
- BGL experiment runner → BGL temporal experiments: temporal experiments
- Root-cause analysis → Transition scoring: score transitions
- Root-cause analysis → Root and chain ranking: rank roots
- Root-cause analysis → Causal graph rendering: render result
- BGL experiment runner → Root-cause analysis: anomalous graph and importance
