# nandannmenon/local-optimization-policy-link-prediction architecture

> Architecture diagram of the GitHub repository nandannmenon/local-optimization-policy-link-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nandannmenon/local-optimization-policy-link-prediction
- Repository: https://github.com/nandannmenon/local-optimization-policy-link-prediction

## Overview

This repository implements a notebook-based link-prediction experiment: graph data is prepared and split, node features and virtual-node connectivity are constructed, and a DQN chooses the GCN aggregation depth used to train and evaluate a link predictor. The README also documents heuristic edge features, validation, and saved results. All implementation components point to the single notebook because no source excerpts were provided; the architecture and relationships below are based on README statements, not inspected notebook code.

Main entry points: [`LOP_Link_Prediction_RL.ipynb`](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb) (Graph Preparation), [`C-elegans-frontal.txt.gz`](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/C-elegans-frontal.txt.gz) (C. elegans Data), [`cora.zip`](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/cora.zip) (CORA Data), [`lop_results.csv`](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/lop_results.csv) (Experiment Results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Graph Data"]
  node_ces["C. elegans Data"]
  node_cora["CORA Data<br/>[cora.zip]"]
  node_synthetic["Synthetic Graphs"]
  node_preparation["Graph Preparation"]
  node_features["Node Features"]
end

subgraph group_model["LOP Model"]
  node_virtual["Virtual Node"]
  node_edgefeatures["Edge Heuristics"]
  node_dqn["DQN Policy"]
  node_gcn["GCN Encoders"]
  node_predictor["Link Predictor"]
end

subgraph group_experiment["Training and Results"]
  node_training["RL Training"]
  node_evaluation["Validation and Test"]
  node_results["Experiment Results<br/>[lop_results.csv]"]
end

node_user(("Researcher"))

node_user -->|"runs experiment"| node_preparation
node_ces -->|"loads graph"| node_preparation
node_cora -->|"loads graph"| node_preparation
node_preparation -->|"generates fallback"| node_synthetic
node_preparation -->|"splits edges"| node_features
node_features -->|"augments graph"| node_virtual
node_training -->|"selects hop"| node_dqn
node_dqn -->|"chooses depth"| node_gcn
node_gcn -->|"produces embeddings"| node_predictor
node_edgefeatures -->|"supplies heuristics"| node_predictor
node_training -->|"trains encoder"| node_gcn
node_training -->|"trains predictor"| node_predictor
node_training -->|"evaluates model"| node_evaluation
node_evaluation -->|"saves metrics"| node_results

click node_ces "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/C-elegans-frontal.txt.gz"
click node_cora "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/cora.zip"
click node_synthetic "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_preparation "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_features "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_virtual "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_edgefeatures "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_dqn "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_gcn "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_predictor "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_training "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_evaluation "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb"
click node_results "https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/lop_results.csv"

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_ces,node_cora,node_synthetic,node_preparation,node_features toneBlue
class node_virtual,node_edgefeatures,node_dqn,node_gcn,node_predictor toneAmber
class node_training,node_evaluation,node_results toneMint
class node_user toneIndigo
```

## Components

### Graph Data

- [C. elegans Data](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/C-elegans-frontal.txt.gz): `C-elegans-frontal.txt.gz`
- [CORA Data](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/cora.zip): `cora.zip`
- [Synthetic Graphs](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [Graph Preparation](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [Node Features](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`

### LOP Model

- [Virtual Node](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [Edge Heuristics](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [DQN Policy](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [GCN Encoders](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [Link Predictor](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`

### Training and Results

- [RL Training](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [Validation and Test](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/LOP_Link_Prediction_RL.ipynb): `LOP_Link_Prediction_RL.ipynb`
- [Experiment Results](https://github.com/nandannmenon/local-optimization-policy-link-prediction/blob/main/lop_results.csv): `lop_results.csv`

### Other components

- **Researcher**

## Connections

- Researcher → Graph Preparation: runs experiment (evidence: `README.md`)
- C. elegans Data → Graph Preparation: loads graph (evidence: `README.md`)
- CORA Data → Graph Preparation: loads graph (evidence: `README.md`)
- Graph Preparation → Synthetic Graphs: generates fallback (evidence: `README.md`)
- Graph Preparation → Node Features: splits edges (evidence: `README.md`)
- Node Features → Virtual Node: augments graph (evidence: `README.md`)
- RL Training → DQN Policy: selects hop (evidence: `README.md`)
- DQN Policy → GCN Encoders: chooses depth (evidence: `README.md`)
- GCN Encoders → Link Predictor: produces embeddings (evidence: `README.md`)
- Edge Heuristics → Link Predictor: supplies heuristics (evidence: `README.md`)
- RL Training → GCN Encoders: trains encoder (evidence: `README.md`)
- RL Training → Link Predictor: trains predictor (evidence: `README.md`)
- RL Training → Validation and Test: evaluates model (evidence: `README.md`)
- Validation and Test → Experiment Results: saves metrics (evidence: `README.md`)
