CLI visualizer of directed acyclic graphs
Project description
py-dagviz
This package creates a text rendering of a directed acyclic graph (DAG) for visualization purposes in a terminal.
It contains a single function visualize_dag
that takes a networkx.DiGraph
object from the networkx package.
• 0
├─• 1
├─┼─• 2
│ ├─┼─• 3
└─│─┴─• 4
└─• 5
Usage
import networkx as nx
from dagviz import visualize_dag
g = nx.DiGraph()
# Creates the graph to visualize
# If the graph contains cycles (i.e., not a DAG), visualization fails
g.add_nodes_from([0, 1, 2, 3, 4, 5])
g.add_edges_from([(0, 1), (0, 2), (1, 2), (1, 3), (1, 5), (2, 4), (0, 4), (2, 3)])
print(visualize_dag(g, round_angle=False))
# • 0
# ├─• 1
# ├─┼─• 2
# │ ├─┼─• 3
# └─│─┴─• 4
# └─• 5
print(visualize_dag(g, round_angle=True)) # display may be bad under some terminal fonts
# • 0
# ├─• 1
# ├─┼─• 2
# │ ├─┼─• 3
# ╰─│─┴─• 4
# ╰─• 5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-dagviz-0.1.0.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file py-dagviz-0.1.0.tar.gz
.
File metadata
- Download URL: py-dagviz-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4676d86d789f2bc10b83abdd7176fdab0f51513ac56ad1a5df7a3182d25faac |
|
MD5 | f9990539bc51db3788972fd23758a5a4 |
|
BLAKE2b-256 | 4292918155536d507986c902317dd56590758d728a4ab7a823412475a452dc53 |
File details
Details for the file py_dagviz-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: py_dagviz-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f727c9190d4151692d4106be694ab16385b32607250b33fa9ed26908d75c8910 |
|
MD5 | 20a5ea0d3f9badac727446cfc8a3aa55 |
|
BLAKE2b-256 | dc0a283dd06883b74c08eb06e7f5fed0073066fcdf5146a22bb2ef5b83563bfd |