This example project demonstrates how to download paper datasets from readme.md, build a DEG graph with preset parameters, run search queries, measure Recall vs. QPS (Queries Per Second), and display the results plot interactively.
Note
All runtime and throughput results published in our papers were evaluated using the native C++ implementation (cpp/). Due to language bindings and runtime dynamics, Python executions may have a small overhead.
audio(192D, 53k base vectors, L2 distance)enron(1369D, 94k base vectors, L2 distance)sift1m(128D, 1M base vectors, L2 distance)deep1m(96D, 1M base vectors, L2 distance)glove(100D, 1.18M base vectors, Angular / InnerProduct distance)
The deglib Python library contains C++ pybind11 bindings (deglib_cpp).
Since pyproject.toml references deglib locally (path = "../../python"), running uv sync automatically copies the C++ sources from cpp/, invokes CMake, and compiles/installs the latest deglib C++ bindings into the local environment:
# Install dependencies & compile latest deglib C++ bindings
uv sync
# If C++ code or pybind11 bindings were modified, force rebuilding the extension:
uv sync --reinstall-package deglibNote: A C++ compiler (MSVC on Windows, GCC/Clang on Linux/macOS) and CMake must be available in your system
PATH.setup.pyhandles copying C++ files, running CMake, and compiling the extension during theuv syncstep.
uv run automatically uses the managed virtual environment.
uv run main.py sift1muv run main.py audio --max-base-vecs 1000dataset: Positional dataset name (sift1m,deep1m,glove,audio,enron,all). Default:audio.--graph-path: Save the generated.deggraph file to this path. Default: none (graph kept in RAM).--instruction: SIMD instruction set (auto,scalar,avx2,avx512). Default:auto.--force-rebuild: Force rebuilding graph files even if they already exist.--threads: Number of threads used for building the graph. Default:1.--cache-dir: Persistent cache folder for datasets. Default:~/.cache/deg_datasets.--no-show: Disable opening the interactive plot window (useful for headless CI environments).--max-base-vecs: Limit base vectors for fast debugging / testing.