TurboGraph: Lightweight Dependency-Driven Computation

TurboGraph: Lightweight Dependency-Driven Computation#

TurboGraph is a simple Python library, for defining and computing values based on dependencies. It is based on the lightweight igraph package. It automatically builds a dependency graph from function argument names or explicit specifications, ensuring computations run in the correct order.

Here’s a simple example showing how TurboGraph automatically infers dependencies:

from turbograph import compute

specifications = {
    "a": 2,
    "sum": lambda a, b: a + b,  # Depends on "a" and "b"
}

result = compute(specifications, ["sum"], {"b": 3})
print(result)  # {"sum": 5}

TurboGraph analyzes the function signatures and determines that "sum" depends on "a" and "b", executing the computations in the correct order.

Indices and tables#