Skip to main content

Mimimal DAG implementation with Python

Project description

Tiny DAG

Bare bones implementation of computation (directed, acyclic) graph for Python.

Requirements

  • Python >= 3.6
  • graphviz

Usage example

from tinydag.graph import Graph
from tinydag.node import Node

add = lambda a, b: a + b
mul = lambda a, b: a * b
div = lambda a, b: a / b

nodes = [
    Node(["add1", "x"], add, "add2"),
    Node(["add1", "add2"], mul, "mul"),
    Node(["x", "y"], add, "add1"),
    Node(["mul", "z"], div, "div"),
]
graph = Graph(nodes)
graph.render()
data = {"x": 5, "y": 3, "z": 3}
results = graph.calculate(data)

render method produces following figure:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiny-dag-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiny_dag-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file tiny-dag-0.0.1.tar.gz.

File metadata

  • Download URL: tiny-dag-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for tiny-dag-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5045b44b91aef541fd5ef720413a200ae49ea5cc1d38c985827b271d4cef4737
MD5 0b1b6aabaf1d172bcee6dc15e7cec600
BLAKE2b-256 b3d4de8a8dd47656ea956bcbda3b075be5080b9a7dcbacf076fe45ae987208bc

See more details on using hashes here.

File details

Details for the file tiny_dag-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tiny_dag-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

File hashes

Hashes for tiny_dag-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff2af700654f31bf3290d72f6e6a7d414bc5b8513871fd5bedd11e2782b0a562
MD5 ca35a999c0a40bbc7fb27aabcb90880a
BLAKE2b-256 64718cd134dcd7f0dbb99a256726d9df4fa0d2209f8479c589ad4d2abf2a7d36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page