Pruning redundant nodes from DOT graphs
Project description
DotPruner

Pruning redundant nodes from DOT graphs
Before:
After:
Installation
To install DotPruner with pip, run: pip install dotpruner
To install DotPruner from source, first clone the repository and then run: python setup.py install
Usage
CLI
Prune graph "in-place":
python -m dotpruner path/to/original/graph.dot
Use --dest or -d to specify destination for new graph:
python -m dotpruner path/to/original/graph.dot --dest path/to/new/graph.dot
Use --overwrite or -o to overwrite existing file in destination:
python -m dotpruner path/to/original/graph.dot -d path/to/new/graph.dot --overwrite
API
import dotpruner
# string representation of DOT graph
original_graph_str = ...
# pruned graph represented using pydot
pruned_graph = dotpruner.process_from_string(original_graph_str)
Optionally pass in a node_picker function
to change which node is preserved in the pruning stage --
by default, the lexicographically smaller node is preserved.
# keep the lexicographically larger node
dotpruner.process_from_string(original_graph_str, node_picker=max)
Tests
python -m unittest discover dotpruner.tests --verbose
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotpruner-0.1.3.tar.gz.
File metadata
- Download URL: dotpruner-0.1.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55631691a0620b3610a960ef5308de160286c85002ad0b1c43190ffb19640f11
|
|
| MD5 |
539a8de3663007f66a26670a3ca8feb7
|
|
| BLAKE2b-256 |
ae2103c21876e839079556b4cb00aabe8ff568a989defe66020eaf5d8a8c8165
|
File details
Details for the file dotpruner-0.1.3-py3-none-any.whl.
File metadata
- Download URL: dotpruner-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fca246a594c7dd0f6842765cbc78920fcdf8587a67d45979fb19a30967c8b7b
|
|
| MD5 |
538d4569d185ce722a508015ce8dbd2e
|
|
| BLAKE2b-256 |
bc1b57af149256246224729318ba3a798d1b26715482dd037db75fde2f8bdd07
|