yagJS
Yet Another Graph theory library in JavaScript.
Status
yagJS is still in pre-alpha stage. The API may change without warning.
Features
- Basic graph operations on directed multi-edge graph
- Basic graph properties on directed multi-edge graph
- Convert from and to common graph file format
- Read SIF file into graph and convert graph into SIF file
- Read XGMML file into graph and convert graph into XGMML file
Usage
var YAG = require('yagjs'),
var graph = new YAG.DiGraphFile();
graph.addNode('a', {name: 'Michael'});
graph.addNode('b', {name: 'John'});
graph.addNode('c', {name: 'Ella'});
graph.addNode('d', {name: 'Sarah'});
graph.addEdge('a', 'b', 'friend', {meetAt: 'Colleage'});
graph.addEdge('a', 'c', 'lover', {married: false});
graph.addEdge('c', 'd', 'employee', {company: 'ABC Co.'});
graph.getInDegreeOf('a', function(err, number) {
if (err) {
throw "unable to get in-degree of a";
}
console.log("The in-degree of a is " + number);
});
// Get SIF file
graph.toSIF('file.sif', __dirname, function (err){
if (err) {
throw "Unable to get SIF file";
}
});
// Get XGMML file
graph.toXGMML('file.xml', __dirname, function (err) {
if (err) {
throw "Unable to get XGMML file";
}
});
Website
Documentation
Online documentation here
To get a local copy of the API documents of yagJS, install yuidoc with the command npm -g install yuidocjs
; run yuidoc -t mytheme src
and get them in the directory apidocs.
TODO
View TODO.txt for the details.
License
MIT