graph_models
This site contains the API documentation for the graph_models package.
Overview
graph_models is the example package that ships with this Python project template.
It provides a simple undirected-graph data structure (UGRAPH) to illustrate the
intended project layout. Replace it with your own code.
Quick Start
from graph_models import UGRAPH
g = UGRAPH(nodes=["A", "B", "C"], edges=[("A", "B"), ("A", "C")])
print(g.num_nodes) # 3
print(g.num_edges) # 2
print(g.adjacency_matrix)
Installation
See the API Reference for detailed documentation.
Manuscript workflow (paper/ and notebooks/)
The template ships with a paired paper/ and notebooks/ layout for projects
that publish alongside a manuscript:
notebooks/holds Jupyter notebooks (figure_creator.ipynb,table_creater.ipynb) that produce results from the package code and write them directly intopaper/figures/(PNG/PDF) orpaper/tables/(LaTeX fragments).paper/holds the LaTeX source.main.texpulls in the generated artefacts via\includegraphics{figures/...}and\input{tables/...}, so re-running a notebook is the canonical way to refresh a result — the.texskeleton stays put.
The shipped class file (paper/uai2026.cls) targets UAI 2026 purely as an
example. Replace it with whatever class your publishing outlet requires
(NeurIPS, ICML, ACL, IEEEtran, Springer LNCS, …); the notebook → paper/
artefact pipeline is venue-agnostic.
Developer Guide
Pre-commit hooks
The project uses pre-commit to enforce code quality before every commit and push.
Hooks are defined in .pre-commit-config.yaml and include:
| Hook | Stage | Purpose |
|---|---|---|
ruff |
commit | Linting and auto-formatting |
trailing-whitespace, end-of-file-fixer, check-yaml, check-added-large-files |
commit | General hygiene |
mypy |
commit | Static type checking (strict mode) |
bandit |
commit | Security vulnerability scanning |
pip-compile (×2) |
push | Re-pin requirements.txt and requirements_dev.txt from pyproject.toml |
Install and run all hooks against every file in one step:
This runs pre-commit install (registers the git hooks) and then pre-commit run --all-files.
After that, hooks run automatically on git commit and git push.
To update hook versions to their latest releases:
Documentation (MkDocs)
Docs are built with MkDocs and the Material theme.
API reference pages are auto-generated from source docstrings via the mkdocstrings plugin.
Preview locally:
Then open http://127.0.0.1:8000.
Build a static site:
Deploy docs to GitHub Pages
Versioned docs are managed with mike, which pushes each release to the gh-pages branch of your repository.
Deploy a new version:
mike deploy --push --update-aliases <version> latest
# e.g. mike deploy --push --update-aliases 0.1.0 latest
Set the default version (only needed once):
View available deployed versions:
Prerequisites: your GitHub repository must have GitHub Pages enabled (Settings → Pages → Source:
gh-pagesbranch). Therepo_urlandsite_urlfields inmkdocs.ymlmust point at your actual repository.