# tkipf/gae architecture

> Architecture diagram of the GitHub repository tkipf/gae, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tkipf/gae
- Repository: https://github.com/tkipf/gae

## Overview

##### Project type and purpose
- This is a research-oriented machine learning library implementing Graph Auto-Encoders (GAEs) and Variational Graph Auto-Encoders (VGAEs) in TensorFlow.
- Its primary function is to load graph data (cora, citeseer, pubmed), build a GCN-based encoder and decoder, optimize a reconstruction or variational loss, and produce embeddings or link-prediction scores.

##### File structure
Top-level files
- setup.py – packaging and install script
- README.md, LICENCE, .gitignore
g a e/
- data/ – serialized dataset files (adjacency + feature matrices for cora, citeseer, pubmed)
- input_data.py – data-loading utilities
- preprocessing.py – adjacency normalization and feature preprocessing
- initializations.py – weight and bias initializers
- layers.py – Graph Convolutional Network (GCN) layer definitions
- model.py – encoder/decoder graph construction for AE and VAE
- optimizer.py – loss functions (reconstruction, KL) and optimizer setup
- train.py – end-to-end training script, hyperparameter parsing

##### README for additional insights
- Describes two models: gcn_ae and gcn_vae
- Specifies required inputs: N×N adjacency, N×D feature matrices
- Recommends how to swap datasets or models via command-line flags

##### Elements
Data files → input_data → preprocessing → model → optimizer → outputs/logs
“Adjacency + Feature matrices”
“Normalized adjacency”
“Latent embeddings z”
“Reconstruction loss / KL divergence”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DataDir["gae/data/"]:::io
        DataFiles(("Raw Dataset Files")):::io
        InputData["input_data.py"]:::io
    end
    click DataDir "https://github.com/tkipf/gae/tree/master/gae/data/"
    click InputData "https://github.com/tkipf/gae/blob/master/gae/input_data.py"

    DataDir --> DataFiles
    DataFiles -->|"Adjacency + Feature matrices"| InputData

    %% Preprocessing Layer
    subgraph "Preprocessing Layer"
        direction TB
        Preproc["preprocessing.py"]:::io
    end
    click Preproc "https://github.com/tkipf/gae/blob/master/gae/preprocessing.py"

    InputData -->|"Loaded matrices"| Preproc
    Preproc -->|"Normalized adjacency & features"| Init

    %% Model Layer
    subgraph "Model Layer"
        direction TB
        Init["initializations.py"]:::model
        Layers["layers.py"]:::model
        ModelConstruct["model.py"]:::model
    end
    click Init "https://github.com/tkipf/gae/blob/master/gae/initializations.py"
    click Layers "https://github.com/tkipf/gae/blob/master/gae/layers.py"
    click ModelConstruct "https://github.com/tkipf/gae/blob/master/gae/model.py"

    Preproc --> Init
    Init -->|"Weight & bias inits"| Layers
    Layers -->|"GraphConv layers, Dropout"| ModelConstruct
    ModelConstruct -->|"Latent embeddings z"| Optimizer

    %% Optimization Layer
    subgraph "Optimization Layer"
        direction TB
        Optimizer["optimizer.py"]:::train
    end
    click Optimizer "https://github.com/tkipf/gae/blob/master/gae/optimizer.py"

    ModelConstruct --> Optimizer
    Optimizer -->|"Reconstruction loss / KL divergence"| Train

    %% Training / Orchestration
    subgraph "Training Layer"
        direction TB
        Train["train.py"]:::train
    end
    click Train "https://github.com/tkipf/gae/blob/master/gae/train.py"

    Optimizer --> Train
    Train -->|"Embeddings z, Link-prediction scores, Logs"| Outputs

    %% Outputs
    Outputs["Outputs"]:::external

    %% Packaging & Metadata
    subgraph "Packaging & Metadata"
        direction TB
        Setup["setup.py"]:::external
        Readme["README.md"]:::external
        Licence["LICENCE"]:::external
    end
    click Setup "https://github.com/tkipf/gae/blob/master/setup.py"
    click Readme "https://github.com/tkipf/gae/blob/master/README.md"
    click Licence "https://github.com/tkipf/gae/tree/master/LICENCE"

    %% Styles
    classDef io fill:#add8e6,stroke:#333,stroke-width:1px
    classDef model fill:#90ee90,stroke:#333,stroke-width:1px
    classDef train fill:#ffa500,stroke:#333,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
```
