提交 4860059b 编写于 作者: J Jason Park

support drawing tree of WeightedGraph

上级 1239b28d
...@@ -59,6 +59,7 @@ GraphTracer.prototype.setTreeData = function (G, root) { ...@@ -59,6 +59,7 @@ GraphTracer.prototype.setTreeData = function (G, root) {
if (this.setData(G, root)) return true; if (this.setData(G, root)) return true;
var place = function (node, x, y) { var place = function (node, x, y) {
console.log(node);
var temp = graph.nodes(n(node)); var temp = graph.nodes(n(node));
temp.x = x; temp.x = x;
temp.y = y; temp.y = y;
......
...@@ -20,6 +20,7 @@ dataEditor.on('change', function () { ...@@ -20,6 +20,7 @@ dataEditor.on('change', function () {
}); });
var loadFile = function (category, algorithm, file, explanation) { var loadFile = function (category, algorithm, file, explanation) {
lastModule = null;
lastData = null; lastData = null;
$('#explanation').html(explanation); $('#explanation').html(explanation);
dataEditor.setValue(''); dataEditor.setValue('');
......
var timer = null; var timer = null;
var lastData = null; var lastModule = null, lastData = null;
var stepLimit = 1e6; var stepLimit = 1e6;
var Tracer = function (module) { var Tracer = function (module) {
...@@ -30,7 +30,8 @@ Tracer.prototype.createRandomData = function (arguments) { ...@@ -30,7 +30,8 @@ Tracer.prototype.createRandomData = function (arguments) {
Tracer.prototype.setData = function (arguments) { Tracer.prototype.setData = function (arguments) {
var data = JSON.stringify(arguments); var data = JSON.stringify(arguments);
if (lastData == data) return true; if (lastModule == this.module && lastData == data) return true;
lastModule = this.module;
lastData = data; lastData = data;
return false; return false;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册