Skip to content

Commit aec1266

Browse files
committed
support drawing tree of WeightedGraph
1 parent bf10c89 commit aec1266

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

js/module/graph.js

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ GraphTracer.prototype.setTreeData = function (G, root) {
5959
if (this.setData(G, root)) return true;
6060

6161
var place = function (node, x, y) {
62+
console.log(node);
6263
var temp = graph.nodes(n(node));
6364
temp.x = x;
6465
temp.y = y;

js/script.js

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dataEditor.on('change', function () {
2020
});
2121

2222
var loadFile = function (category, algorithm, file, explanation) {
23+
lastModule = null;
2324
lastData = null;
2425
$('#explanation').html(explanation);
2526
dataEditor.setValue('');

js/tracer.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var timer = null;
2-
var lastData = null;
2+
var lastModule = null, lastData = null;
33
var stepLimit = 1e6;
44

55
var Tracer = function (module) {
@@ -30,7 +30,8 @@ Tracer.prototype.createRandomData = function (arguments) {
3030

3131
Tracer.prototype.setData = function (arguments) {
3232
var data = JSON.stringify(arguments);
33-
if (lastData == data) return true;
33+
if (lastModule == this.module && lastData == data) return true;
34+
lastModule = this.module;
3435
lastData = data;
3536
return false;
3637
};

0 commit comments

Comments
 (0)