From 1c4042325d09273ae46c04c1fd5f0e471b82b7d3 Mon Sep 17 00:00:00 2001 From: hppeng Date: Sat, 21 May 2022 21:19:43 -0700 Subject: [PATCH] Add method for "linking" compute nodes together just smol standard things --- js/computation_graph.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/computation_graph.js b/js/computation_graph.js index fcefe03..4e193c6 100644 --- a/js/computation_graph.js +++ b/js/computation_graph.js @@ -24,7 +24,7 @@ class ComputeNode { * Request update of this compute node. Pushes updates to children. */ update(timestamp) { - if (timestamp < this.update_time) { + if (timestamp <= this.update_time) { return; } this.update_time = timestamp; @@ -52,6 +52,11 @@ class ComputeNode { compute_func() { throw "no compute func specified"; } + + link_to(parent_node) { + this.inputs.push(parent_node) + parent_node.children.push(this); + } } /***