您的位置:首页 > Web前端 > Node.js

graph.js整合node和edge资源,对外提供访问接口

2017-08-27 13:09 447 查看
/*

 Class: Graph

 A Graph Class that provides useful manipulation functions. You can find more manipulation methods in the <Graph.Util> object.

 An instance of this class can be accessed by using the *graph* parameter of any tree or graph visualization.

 

 Example:

 (start code js)

   //create new visualization

   var viz = new $jit.Viz(options);

   //load JSON data

   viz.loadJSON(json);

   //access model

   viz.graph; //<Graph> instance

 (end code)

 

 Implements:

 

 The following <Graph.Util> methods are implemented in <Graph>

 

  - <Graph.Util.getNode>

  - <Graph.Util.eachNode>

  - <Graph.Util.computeLevels>

  - <Graph.Util.eachBFS>

  - <Graph.Util.clean>

  - <Graph.Util.getClosestNodeToPos>

  - <Graph.Util.getClosestNodeToOrigin>

 

*/  

$jit.Graph = new Class({
initialize: function(opt, Node, Edge, Label) {
this.Node = Node; //存储node的配置项
this.Edge = Edge; //存储edge的配置项
this.Label = Label;
this.opt = $.merge(innerOptions, opt || {});
this.nodes = {}; //存储所有的nodes
this.edges = {}; //存储所有的edges

},
getNode: function(id) {},
getByName: function(name) {},
getAdjacence: function (id, id2) {},
addNode: function(obj) {},
addAdjacence: function (obj, obj2, data) {},
removeNode: function(id) {},
removeAdjacence: function(id1, id2) {},
hasNode: function(id) {},
empty: function() {}
});

后续更新。。。。

         
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: