The Problem
Students and researchers need a reproducible set of lecture notes, code examples, and small projects to learn graph neural networks (GNNs) with DGL. The material must be runnable on a local machine without hidden dependencies or large binary blobs that break version control.
What This Does
The repository bundles three logical units:
- Lecture‑notes – PDFs for six lectures (e.g.,
Lecture-notes/DGL_Lecture_2/DGL_Lecture_2_Clean.pdf). - Tutorials – 40 Jupyter notebooks that walk through graph preprocessing, GCN layers, sampling, and training (e.g.,
Tutorials/Tutorial-4/DGL_Tutorial_4.ipynb). - Project – a minimal research‑style code base (
Project/MatrixVectorizer.py,Project/evaluation_measures.py,Project/reproducibility.py) that implements a simple matrix‑vector encoder and evaluation utilities.
All instructional code lives in the notebooks; the Project files provide reusable helpers that the notebooks import.
How It Is Wired
Execution starts in a notebook cell. The most frequently executed notebook is Tutorials/Tutorial-4/DGL_Tutorial_4.ipynb, which imports the following core symbols:
norm_g,GCN,GCNLayer– defined in the notebook itself.train,sigmoid,sample– defined in the same notebook; each is called from three distinct places (e.g.,trainis used for both supervised and unsupervised runs).
The internal call graph shows 96 intra‑repo call edges. High‑traffic functions include:
| Function | Callers | Callees |
|---|---|---|
train | 3 places | – |
sigmoid | 3 places | – |
sample | 3 places | – |
GCN | 2 places | GCNLayer (x15) |
norm_g | 2 places | – |
add_node_and_update / add_edge_or_not | 2 places each | – |
The Project/MatrixVectorizer.py module is isolated (no other file imports it), but its vectorize method is used inside a few notebooks to turn adjacency matrices into feature vectors. This file suffers from deep nesting (max indentation depth 6), making the control flow harder to follow and increasing the risk of bugs when extending the encoder.
No external services are invoked; the only “outside” calls are to DGL library functions (e.g., dgl.nn.pytorch.GCNLayer) and standard PyTorch ops. The notebooks also load the PDFs for visual reference, but no network or database access occurs.
How To Use It
# 1. Clone the repository
git clone https://github.com/moses-y/DGL-course DGL-course
cd DGL-course
# 2. Install the Python stack (requirements are missing – you must create one)
# Example (adjust versions as needed):
# pip install dgl torch matplotlib pandas numpy tqdm
- Configuration – there are no config files or environment variables; notebooks contain all paths inline.
- Running – open any tutorial notebook in JupyterLab/Jupyter Notebook (e.g.,
jupyter notebook Tutorials/Tutorial-1/DGL_Tutorial_1.ipynb) and execute cells sequentially. - Project code – to test the encoder locally, run the snippet in a notebook cell:
from Project.MatrixVectorizer import MatrixVectorizer
vec = MatrixVectorizer()
features = vec.vectorize(some_adj_matrix)
Real‑World Use
A university teaching assistant can copy the repo, install DGL & PyTorch, and run the notebooks to demonstrate GCN training on synthetic molecular graphs. The MatrixVectorizer class can be imported into a research script to generate fixed‑size graph embeddings for downstream clustering.
Code Health & Issues
- High – Pin the environment – 9 notebooks, no
requirements.txtorenvironment.yml. Without a manifest the repo cannot be reproduced. - Medium – Strip notebook outputs –
Project/DGL_Dataset_EDA.ipynbcontains >1 MB of stored output; bloats the repo and leaks transient data. - Medium – Move large PDFs to Git LFS – several lecture PDFs exceed 10 MB each (e.g.,
Lecture-notes/DGL_Lecture_2/DGL_Lecture_2_Clean.pdf). They increase clone size and should be LFS‑tracked or hosted externally. - Medium – Deep nesting –
Project/MatrixVectorizer.pyreaches indentation depth 6, reducing readability and maintainability. Refactor with early returns or helper functions. - Medium – No tests, CI, or license – repository lacks a test suite, any CI configuration, and a LICENSE file, making automated validation and legal reuse uncertain.
The Bottom Line
The repo offers a complete, lecture‑driven GNN curriculum with working notebooks, but it is not production‑ready. Missing dependency specifications, large binary assets, and limited test coverage hinder reproducibility. It is suitable for educators or learners who can supply their own environment setup and are comfortable editing the notebooks to add missing scaffolding.