Skip to main content

Draw DAGs (directed acyclic graphs) as ASCII art, à la git log --graph

Project description

Travis CI status AppVeyor CI status Coverage Requirements Status

Overview

This is a direct port of the Git log graphing code, which draws directed acyclic commit graphs as ASCII art. It was done very mechanically and quickly, so the code is not Pythonic. Dependencies on Git specifics should be gone but look and feel remains.

This project is alpha quality and subject to breaking API changes.

Installation

Available for install/upgrade from PyPI:

pip install -U asciidag

As usual, it is best to install your packages into a virtual environment.

Usage

examples/demo.py is included in the installation directory and is executable. The core functionality is:

from asciidag.graph import Graph
from asciidag.node import Node

graph = Graph()

root = Node('root')
grandpa = Node('grandpa', parents=[root])
tips = [
    Node('child', parents=[
        Node('mom', parents=[
            Node('grandma', parents=[
                Node('greatgrandma', parents=[]),
            ]),
            grandpa,
        ]),
        Node('dad', parents=[
            Node('bill', parents=[
                Node('martin'),
                Node('james'),
                Node('paul'),
                Node('jon'),
            ])]),
        Node('stepdad', parents=[grandpa]),
    ]),
    Node('foo', [Node('bar')]),
]

graph.show_nodes(tips)

Output:

Demonstration screenshot
copyright:

© 2016 Sam Brightman

license:

GNU General Public License v2.0, see LICENSE for more details.

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

asciidag-0.2.0.tar.gz (133.4 kB view hashes)

Uploaded Source

Built Distribution

asciidag-0.2.0-py2.py3-none-any.whl (20.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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