Tutorials#

Lessons that take you through a complete task, step by step.

Hypergraph triads (0.3) does its task in C++ and in Python. For the graph algorithms, until their Python tutorials exist, A first update in Python and the Python sections of sssp: dynamic single-source shortest paths and cycle_count: exact k-bounded directed simple-cycle histograms show the steps.

Planned, each written when its code exists:

Tutorial

Release

Dynamic SSSP in Python in 10 minutes

later (planned for 0.2.x, which was not made)

Cycle counting on a changing graph

later (planned for 0.2.x, which was not made)

Aggregate deltas (triangle_delta: signed recounts with an ownership rule; the code and its page exist since 0.2)

later

MOSP with preferences

later (planned for 0.2.x, which was not made)

Hypergraph triads (triad_count, in C++ and Python): delivered, Hypergraph triads

0.3

Count a new hypergraph pattern (an Op) (experimental::count_local_patterns): delivered, Count a new hypergraph pattern (an Op)

0.3

Streaming label propagation (label_propagation, in Python): delivered, Streaming label propagation

0.4

Shortest hyperpaths (hyper_sssp, in C++ and Python): delivered, Shortest hyperpaths

0.4

Your first dynamic algorithm (0.2) builds my_bfs, a dynamic BFS, from a fresh clone to a green conformance kit with scripts/new_algorithm.py and the fixed-point template. Its reference solution is in examples/tutorial_algorithms/my_bfs/; the tutorial quotes it by marked ranges (a change that removes a marker breaks the documentation build), and ci/scaffold_check.sh scaffolds my_bfs, makes the tutorial’s edits in the scaffold’s files where the prose puts them (ci/tutorial_edits.py) and runs its kit, so a framework or scaffold change that breaks the tutorial, or a step whose prose does not build, breaks CI. The two teaching algorithms of the library, dynamic_bfs: BFS levels under edge batches (tutorial) and triangle_delta: the triangle count under edge batches (tutorial) (maturity tutorial), are the finished versions on every backend (ADR 0033).

Hypergraph triads (0.3) counts the triads of a .hg hypergraph by h-motif and by StatHyper’s type 1, applies the hyperedge batches of a .dgt file to both results with one dyng::update(), and reads the deltas and the inserted ids, in C++ and in Python with the same output; its code is examples/cpp/triad_count_update.cpp and examples/python/triad_count.py, which CI runs on every backend (the C++ one built against the installed package) against the committed expected output.

Count a new hypergraph pattern (an Op) (0.3) writes four Ops for experimental::count_local_patterns, the extension point of triad_count’s wedge engine (the line graph’s triangles, the pairs of hyperedges sharing k vertices, triangles by the size of their core, and pairs through a vertex), checks them against a brute force and triad_count, and keeps them exact under hyperedge batches on the GPU and the CPU. Its code is in examples/tutorial_algorithms/local_patterns/, built and run on every backend by the local GPU gate (ci/gpu_local.sh: it needs nvcc and a GPU), while hosted CI runs its host half (the Ops’ callbacks driven by hand, without nvcc); the page quotes it by marked ranges, and ci/tutorial_quotes.py (run by ci/docs.sh) pins every quote of the tutorials, so a quoted line that moves or changes without its page fails the documentation check.

Streaming label propagation (0.4) runs label_propagation twice: on LabelPropagation-CUDA’s synthetic stream in the published setup, with the original’s labels byte for byte, and on feature vectors of your own, through the kNN recipe datasets/preprocess/knn_graph.py, in the streaming mode (slack rows, the current graph’s threshold), with the labels read by PyTorch without a copy. It quotes examples/python/label_propagation_torch.py and python/tests/test_label_propagation_tutorial.py, which the Python suites run, and ci/tutorial_quotes.py pins every quote.

Shortest hyperpaths (0.4) builds a weighted hypergraph with slack_csr storage, computes the shortest hyperpaths from two source vertices, applies batches of hyperedge operations and incidence edits to both with one dyng::update(), reads the vertex distances and a path, tunes the work budget and checks the results against the oracle, in C++ and in Python with the same output; its code is examples/cpp/hyper_sssp_update.cpp, examples/python/hyper_sssp.py and two tests (hyper_sssp_tutorial_test.cpp, test_shortest_hyperpaths_tutorial.py), which CI runs against the committed expected output and the oracle.