0.0.5 • Published 9 years ago

ngraph.ascii v0.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

ngraph.ascii

A simple toy to render a graph with text symbols.

build status

Example

This will render a 10x10 grid graph in your terminal:

var graph = require('ngraph.generators').grid(10, 10);
var asciiGraphics = require('ngraph.ascii').graphics(graph);

asciiGraphics.run();

You can also customize how each node is rendered, by passing a callback:

var graph = require('ngraph.generators').grid(10, 10);
var asciiGraphics = require('../').graphics(graph);

asciiGraphics.createNodeUI(function (node) {
  return '+'; // each node is now rendered as a '+' symbol
});

asciiGraphics.run();

Even though the name says ascii you can use unicode symbols if your terminal supports them:

http://i.snag.gy/XiQMS.jpg

Note: in these examples we are using ngraph.generators to create a predefined graph. You can always use ngraph.graph for custom graphs.

install

With npm do:

npm install ngraph.ascii

license

MIT

0.0.5

9 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago