0.1.0 • Published 11 years ago

undirender v0.1.0

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

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

0.1.0

11 years ago

0.0.0

12 years ago