forked from anvaka/ngraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·23 lines (19 loc) · 874 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module.exports.main = function () {
var graph = getGraphFromQueryString(window.location.search.substring(1));
var fabricGraphics = require('ngraph.fabric')(graph);
// this is a power of fabric. Shared ui settings can be used both on the
// server side inside node.js application and in the browser. Check out
// `doItFromNode.js` example to see how it's used inside node
require('./ui')(fabricGraphics, fabric);
// begin animation loop:
fabricGraphics.run();
};
function getGraphFromQueryString(queryString) {
var query = require('query-string').parse(queryString);
var n = parseInt(query.n, 10) || 10;
var m = parseInt(query.m, 10) || 10;
var graphGenerators = require('ngraph.generators');
var createGraph = graphGenerators[query.graph] || graphGenerators.ladder;
return graphGenerators.grid3(10,10,10);
// return createGraph(n, m, 10);
}