Announcing PHART: Pure Python ASCII Graph Visualization

115 views
Skip to first unread message

Scott VR

unread,
Dec 9, 2024, 8:29:45 PM12/9/24
to networkx-discuss
Hi all,

I wanted to share PHART (Python Hierarchical ASCII Rendering Tool), a new visualization tool built on NetworkX that renders graphs in ASCII/Unicode text. It was initially created for my own need, but the current structure and development process was guided by discussions in the NetworkX community about text-based graph visualization needs, and the perhaps "separate, necessary evil" space that visualization code in general may reside wrt NX.

Key features:
- Pure Python implementation (NetworkX is the only dependency)
- Multiple node decorator styles (square, round, diamond)
- Support for directed and undirected graphs
- Handles cycles and complex layouts
- CLI tool included

Quick example of output for the simple graph:
G = nx.DiGraph()
G.add_edges_from([("A", "B"), ("A", "C"), ("B", "D")]) 
...
        [A] 
          │ 
  v      │      v 
[B]────[C] 
  │ 
  │ 
   v ──[D] 

More complex examples, including visualization of the World Chess Championship graph from NetworkX's gallery, can be found in the documentation (the README on github has a large example section.) 

You can install it with: pip install phart

GitHub: https://github.com/scottvr/phart
PyPI: https://pypi.org/project/phart/

Feedback and contributions welcome!

Russell Jurney

unread,
Dec 9, 2024, 10:29:20 PM12/9/24
to networkx...@googlegroups.com
This is beautiful. I needed this just the other day for a README :)

--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/networkx-discuss/fee9ebe9-96aa-49e7-ae50-5c34e05d47fen%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages