Skip to main content

dynG

dynG keeps the results of graph and hypergraph algorithms up to date while the structure changes in batches of insertions and deletions, without recomputing from scratch. It unifies the research codes of DynaMOSP (dynamic single- and multi-objective shortest paths), TruCy / DynTruCy (cycle counting), ESCHER / ESCHER+ (hypergraph triads), DynLP (label propagation under vertex batches) and H-SOSP (shortest hyperpaths): dyng.sssp, dyng.mosp, dyng.cycle_count, the hypergraph dyng.Hypergraph, dyng.triad_count, dyng.label_propagation and dyng.hyper_sssp are stable (the last two from 0.4.0); dyng.dynamic_bfs and dyng.triangle_delta are small tutorial algorithms.

import dyng

g = dyng.Graph.from_edges([0, 0, 1, 2], [1, 2, 2, 3], [4, 1, 1, 5])   # src, dst, weights
tree = dyng.sssp.compute(g, source=0)                                # shortest-path tree
batch = dyng.EdgeBatch(insert=([1], [3], [1]), delete=([0], [2]))
stats = dyng.sssp.update(g, batch, tree)                             # incremental update
print(tree.distances.to_numpy(), stats.invalidated)

hist = dyng.cycle_count.compute(g, max_length=4)                     # simple cycles by length
print(hist.counts.tolist(), hist.total)

w2 = [[4, 1], [1, 5], [1, 1], [5, 2]]                                # two objectives per edge
g2 = dyng.Graph.from_edges([0, 0, 1, 2], [1, 2, 2, 3], w2)
paths = dyng.mosp.compute(g2, source=0)                              # multi-objective (MOSP)
dyng.mosp.update(g2, dyng.EdgeBatch(delete=([0], [2])), paths)
print(paths.path_costs.to_numpy().tolist())                          # the K costs per vertex

h = dyng.Hypergraph.from_lists([[0, 1, 2], [1, 2, 3], [0, 2, 3]])    # three hyperedges
triads = dyng.triad_count.compute(h)                                 # the 30 h-motif bins
dyng.triad_count.update(h, dyng.HyperedgeBatch(insert_hyperedges=[[0, 1, 3]]), triads)
print(triads.total, triads.counts.nonzero()[0].tolist())             # triads, non-zero bins

seq = dyng.Resources("sequential")                    # (no OpenMP backend for the next two)
s = dyng.generators.vertex_arrival_stream(total_vertices=2000, num_batches=4, seed=7,
                                          resources=seq)
g3 = dyng.Graph.with_capacity(s.row_capacity, layout="slotted", semantics="net_effect",
                              resources=seq)
lp = dyng.label_propagation.compute(g3, similarity_threshold=s.similarity_threshold)
for b in s.batches:                                                  # vertices arrive in batches
    dyng.label_propagation.update(g3, b, lp)                         # label propagation (DynLP)
print(g3.num_active_vertices, int((lp.labels.to_numpy() >= 0.5).sum()))   # vertices, class 1

h2 = dyng.Hypergraph.from_lists([[0, 1], [1, 2], [2, 3], [0, 3]], [2, 3, 1, 9],
                                storage="slack_csr", line_graph="slack_csr", resources=seq)
sp = dyng.hyper_sssp.compute(h2, source=0)                           # shortest hyperpaths
dyng.hyper_sssp.update(h2, dyng.HyperedgeBatch(insert_incidences=([0], [3])), sp)
print(sp.hyperedge_distances.tolist(), sp.vertex_distances().tolist())

The package also installs the dyng command line, which reads and writes the formats of the original tools:

$ dyng cycle_count compute --graph DD_A.txt --max-length 6       # histogram CSV
$ dyng sssp compute --graph roadNet-CA_ --out init                # MOSP's distance and tree files
$ dyng sssp update --graph roadNet-CA_ --changes batch --init init --out updated
$ dyng mosp update --graph roadNet-CA_ --changes batch --init init --preferences 4,1,4 --out out
$ dyng triad_count update --input coauth.hg --batches batches.dgb --format json   # triad bins JSON
$ dyng label_propagation update --generate legacy --total-vertices 50000 --num-batches 10 --out lp
$ dyng hyper_sssp update --input h.hg --batches batches.dgt --source 0 --out paths

This wheel contains the sequential and OpenMP backends (dyng.Resources("openmp")). The CUDA backend comes as a plugin wheel of the same version, from 0.2: pip install "dyng[cu13]" (an NVIDIA driver of CUDA 13) or pip install "dyng[cu12]" (CUDA 12); dyng.Resources.cuda() then runs every algorithm on the GPU, and dyng.show_config() reports which module is used. Upgrading from an earlier release (0.3.0, 0.2.0 or 0.1.0): pip install -U "dyng[cu13]" (or "dyng[cu12]", or -U dyng without the plugin); without -U pip keeps the installed release. The C++ library, the documentation and the parity reports with the original codes are at https://github.com/dyng-dev/dyng.

Cite dynG and the papers behind the algorithms you use: dyng.citation("sssp").

License: dynG is Apache-2.0. The wheel also contains nanobind (BSD-3-Clause), robin-map (MIT) and the GCC runtime (GPL-3.0-or-later WITH GCC-exception-3.1), which the distributions' licence expression names; their licences are in THIRD_PARTY_LICENSES.txt.

Metadata

Release files for dyng 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dyng 0.4.0
File Size Uploaded Provenance Actions
dyng-0.4.0.tar.gz 2.2 MB With provenance Details for dyng-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dyng 0.4.0
File Interpreter ABI Platform Actions
dyng-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for dyng-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 4.9 MB

Release files / dyng-0.4.0.tar.gz

Download URL dyng-0.4.0.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
37d26973562acd95ce2c5c837c23c091744e45f6eaae3f6789d4f6ef88d5bcfe
BLAKE2b-256 checksum
How to use checksums
438c2c75d23d6ac95b835385cc2709994d1a43e190eb1d52fd38e9d02d8ffb39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / dyng-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL dyng-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
02d2a6b056893a1ce45c428dafee9cf77336abc43389d7de94a7826ec3f7b715
BLAKE2b-256 checksum
How to use checksums
0107a7165b9180852413243824fe600615e9682d4cfe76426347cd18505e95d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for dyng 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dyng-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page