Skip to main content

Visualization for DAGs

Project description

DAGVIZ

DAGVIZ offers a "git log"-like visualization for DAGs represented in networkx.

Installation

DAGVIZ can be installed with pip:

pip install dagviz

Documentation

Documentation is available at https://wimyedema.github.io/dagviz/.

Usage

DAGVIZ relies on networkx for the representation and manipulation of the DAG. An SVG file can be generated as follows:

    import dagviz
    import networkx as nx
    # Create the DAG
    G = nx.DiGraph()
    for i in range(5):
        G.add_node(f"n{i}")
    G.add_edge(f"n0", f"n1")
    G.add_edge(f"n0", f"n2")
    G.add_edge(f"n0", f"n4")
    G.add_edge(f"n1", f"n3")
    G.add_edge(f"n2", f"n3")
    G.add_edge(f"n3", f"n4")
    # Create an SVG as a string
    r = dagviz.render_svg(G)
    with open("simple.svg", "wt") as fs:
        fs.write(r)

Custom styling

The Metro style can be customized using StyleConfig. This is especially useful for rendering on dark backgrounds:

    from dagviz.style.metro import svg_renderer, StyleConfig

    dark_style = svg_renderer(StyleConfig(
        node_stroke="black",
        label_font_color="white",
        bridge_color="black",
        label_arrow_stroke="grey",
    ))

    r = dagviz.render_svg(G, style=dark_style)

See the Metro styling notebook for a full overview of all available options.

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

dagviz-0.6.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

dagviz-0.6.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file dagviz-0.6.0.tar.gz.

File metadata

  • Download URL: dagviz-0.6.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dagviz-0.6.0.tar.gz
Algorithm Hash digest
SHA256 7f94bd0d745d042c4345a336abda9298928a81a9e4e042ef6c8cf930099c2ab8
MD5 cc358775075a3d0a09283c5aa9dd67e0
BLAKE2b-256 0206914b79ce7b37a4793ac247eaebc4d0a00b3b402ed7cfb3d301bb2cfd0f7c

See more details on using hashes here.

File details

Details for the file dagviz-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: dagviz-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dagviz-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 800ab8c93f6defe1a699d5c69317d17b7409944d7e93073967ee456bdaee829c
MD5 b4232261dd03165ec166a00d27019492
BLAKE2b-256 3482618a099c8feb1feb16f12b05058c4359ade373a858ae2e052425bca20dca

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