ASCII Visualisation of a graph of nodes in python

Perhaps port the ASCII graph layout logic from Perl's Graph::Easy?


This is non-trivial to do in ascii as evidenced by the lack of complete answers in:

Python ASCII Graph Drawing

That said, there are a lot of tools available to draw graphs in non-ascii ways. Check out the plotting capabilities associated with NetworkX and Matplotlib for starters:

http://networkx.lanl.gov/

http://matplotlib.sourceforge.net/

and also pydot:

http://code.google.com/p/pydot/


We had a similar problem in DVC project and after lurking around and even trying to port Graph::Easy into Python, we've realized that there is no cross-platform python library that can do that and not require some heavy dependencies like Graphviz. So we've ended up with using an amazing library called Grandalf that handled the layout for us, then we render the results ourselves in ASCII and present them using a pager (this is how stuff like git log makes it's output nice and scrollable both horizontally and vertically). See the whole code here.

+-------------------+           +--------------------+
| test_data.csv.dvc |           | train_data.csv.dvc |
+-------------------+           +--------------------+
                  **              **                  
                    ***        ***                    
                       **    **                       
                +-------------------+                 
                | featurization.dvc |                 
                +-------------------+                 
                  ***            ***                  
                **                  ***               
              **                       **             
    +--------------+                     **           
    | training.dvc |                   **             
    +--------------+                ***               
                  ***            ***                  
                     **        **                     
                       **    **                       
                     +---------+                      
                     | Dvcfile |                      
                     +---------+