Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

undirender

substack4MIT0.1.0

render undirected graphs in the terminal

graph, render, console, terminal, line, point, edge, node

readme

undirender

render undirected graphs in the terminal

example

var undirender = require('undirender');

var s = undirender(80, 20, [
    [ 'a', 'b' ],
    [ 'a', 'e' ],
    [ 'b', 'c' ],
    [ 'b', 'd' ],
    [ 'c', 'e' ],
    [ 'd', 'e' ],
    [ 'd', 'g' ],
    [ 'g', 'h' ],
    [ 'h', 'e' ]
]);
console.log(s);

$ node example/edges.js
                                               a¯¯                              
                                           /¯¯¯|                                
                   h¯                   /¯¯    |                                
                /¯¯  \_              /¯¯       |                                
             /¯¯       \_        /¯¯¯          |                                
          /¯¯            \_   /¯¯              |                                
        /¯                 e____               |                                
     /¯¯                  /     \____          |                                
  /¯¯                    /           \____     |                                
g__                     /                 \____|                                
   \__                 /                       |_____                           
      \__             /                        |     \____                      
         \__         /                         |          \____                 
            \__     /                          |               \____            
               \___/                           |                    \_____      
                  \d________                   |                          c¯¯¯¯¯
                            \________          |                 /¯¯¯¯¯¯¯¯      
                                     \________ |       /¯¯¯¯¯¯¯¯¯               
                                               b                                

methods

var undirender = require('undirender')

undirender(width, height, alist)

Given the [https://en.wikipedia.org/wiki/Adjacency_list](adjacency list) alist that describes an undirected graph, return a string of width rows by height columns that renders the graph in a fixed-width font.

install

With npm do:

npm install undirender

license

MIT