From 4860059bc544e5b5d6b0d596b9e7b28f0aaec287 Mon Sep 17 00:00:00 2001 From: Jason Park Date: Thu, 19 May 2016 01:43:50 -0500 Subject: [PATCH] support drawing tree of WeightedGraph --- js/module/graph.js | 1 + js/script.js | 1 + js/tracer.js | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/js/module/graph.js b/js/module/graph.js index 0f1a380..3e8bfef 100644 --- a/js/module/graph.js +++ b/js/module/graph.js @@ -59,6 +59,7 @@ GraphTracer.prototype.setTreeData = function (G, root) { if (this.setData(G, root)) return true; var place = function (node, x, y) { + console.log(node); var temp = graph.nodes(n(node)); temp.x = x; temp.y = y; diff --git a/js/script.js b/js/script.js index 7cdcc73..f35389f 100644 --- a/js/script.js +++ b/js/script.js @@ -20,6 +20,7 @@ dataEditor.on('change', function () { }); var loadFile = function (category, algorithm, file, explanation) { + lastModule = null; lastData = null; $('#explanation').html(explanation); dataEditor.setValue(''); diff --git a/js/tracer.js b/js/tracer.js index f5bc147..115333b 100644 --- a/js/tracer.js +++ b/js/tracer.js @@ -1,5 +1,5 @@ var timer = null; -var lastData = null; +var lastModule = null, lastData = null; var stepLimit = 1e6; var Tracer = function (module) { @@ -30,7 +30,8 @@ Tracer.prototype.createRandomData = function (arguments) { Tracer.prototype.setData = function (arguments) { var data = JSON.stringify(arguments); - if (lastData == data) return true; + if (lastModule == this.module && lastData == data) return true; + lastModule = this.module; lastData = data; return false; }; -- GitLab