Loading templates/bg_graph.html +1 −1 Original line number Diff line number Diff line <div id="knWrapper"> <h4 class="d-konami m-2">Multidirectional Dijkstra background by Spak</h4> <h4 class="d-konami m-2">Multidirectional Spanning Tree by Spak</h4> <button type="button" class="btn btn-light m-2 d-konami" data-toggle="modal" data-target="#knCustomizeModal"> Customize </button> Loading templates/konami.html +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ </div> </div> <div class="form-group form-row mb-1"> <label for="knTrunkCol" class="col text-right col-form-label col-form-label-sm">Steiner tree path color</label> <label for="knTrunkCol" class="col text-right col-form-label col-form-label-sm">Spanning tree path color</label> <div class="col-5"> <input type="text" class="form-control-sm form-control" id="knTrunkCol" value="#444"> </div> Loading webpack/js/mlab.js +18 −3 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ import 'bootstrap'; require('typeface-ubuntu'); var bounds = require('binary-search-bounds') import Konami from 'konami'; const Snap = require( "imports-loader?this=>window,fix=>module.exports=0!snapsvg/dist/snap.svg.js" ); Loading Loading @@ -72,7 +74,12 @@ function paintTree() { const dx = FEAS_CENTER[0] - pos[0] const dy = FEAS_CENTER[1] - pos[1] const l2 = Math.sqrt(dx * dx + dy * dy) const unit_l2 = Math.max(Math.min((l2 - FEAS_RAD) / FEAS_FALLOFF, 1.), 0.) let unit_l2 = null if (FEAS_FALLOFF > 0) { unit_l2 = Math.max(Math.min((l2 - FEAS_RAD) / FEAS_FALLOFF, 1.), 0.) } else { unit_l2 = l2 >= FEAS_RAD ? 1. : 0. } const l2_pow_law = Math.pow(unit_l2, FEAS_FALLOFF_EXP) const rand_lerp = l2_pow_law * (1. - FEAS_RND_FRAC) + FEAS_RND_FRAC * Math.random() return rand_lerp Loading Loading @@ -134,16 +141,24 @@ function paintTree() { } }) let cdf = [0.] for (let nodeIdx = 0; nodeIdx < grid.numNodes; nodeIdx++) { cdf.push(cdf[cdf.length - 1] + node_feasibility(nodeIdx)) + 1e-5 } function get_random_unreachable_node() { let node = null while (node == null || algo.labels[node].isReachable() || node_feasibility(node) < 0.5) { node = Math.floor(Math.random() * grid.numNodes) while (node == null || algo.labels[node].isReachable()) { // We should not be getting grid.numNodes, but to be safe we upper bound it. node = Math.min(grid.numNodes - 1, bounds.le(cdf, Math.random() * cdf[cdf.length - 1])) } return node } for (let i = 0; i < N_SOURCES; i++) { algo.addSource(get_random_unreachable_node(), true) } const anim = setInterval(function() { for (let i = 0; i < LBLS_PER_FRAME; ++i) { const result = algo.propagate(true) Loading webpack/package-lock.json +6 −0 Original line number Diff line number Diff line Loading @@ -822,6 +822,12 @@ "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==", "dev": true }, "binary-search-bounds": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/binary-search-bounds/-/binary-search-bounds-2.0.4.tgz", "integrity": "sha512-2hg5kgdKql5ClF2ErBcSx0U5bnl5hgS4v7wMnLFodyR47yMtj2w+UAZB+0CiqyHct2q543i7Bi4/aMIegorCCg==", "dev": true }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", Loading webpack/package.json +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ "webpack": "^4.25.1", "webpack-bundle-analyzer": "^3.0.3", "webpack-cli": "^3.1.2", "typeface-ubuntu": "^0.0.65" "typeface-ubuntu": "^0.0.65", "binary-search-bounds": "^2.0.4" }, "dependencies": { "@fortawesome/fontawesome": "^1.1.8", Loading Loading
templates/bg_graph.html +1 −1 Original line number Diff line number Diff line <div id="knWrapper"> <h4 class="d-konami m-2">Multidirectional Dijkstra background by Spak</h4> <h4 class="d-konami m-2">Multidirectional Spanning Tree by Spak</h4> <button type="button" class="btn btn-light m-2 d-konami" data-toggle="modal" data-target="#knCustomizeModal"> Customize </button> Loading
templates/konami.html +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ </div> </div> <div class="form-group form-row mb-1"> <label for="knTrunkCol" class="col text-right col-form-label col-form-label-sm">Steiner tree path color</label> <label for="knTrunkCol" class="col text-right col-form-label col-form-label-sm">Spanning tree path color</label> <div class="col-5"> <input type="text" class="form-control-sm form-control" id="knTrunkCol" value="#444"> </div> Loading
webpack/js/mlab.js +18 −3 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ import 'bootstrap'; require('typeface-ubuntu'); var bounds = require('binary-search-bounds') import Konami from 'konami'; const Snap = require( "imports-loader?this=>window,fix=>module.exports=0!snapsvg/dist/snap.svg.js" ); Loading Loading @@ -72,7 +74,12 @@ function paintTree() { const dx = FEAS_CENTER[0] - pos[0] const dy = FEAS_CENTER[1] - pos[1] const l2 = Math.sqrt(dx * dx + dy * dy) const unit_l2 = Math.max(Math.min((l2 - FEAS_RAD) / FEAS_FALLOFF, 1.), 0.) let unit_l2 = null if (FEAS_FALLOFF > 0) { unit_l2 = Math.max(Math.min((l2 - FEAS_RAD) / FEAS_FALLOFF, 1.), 0.) } else { unit_l2 = l2 >= FEAS_RAD ? 1. : 0. } const l2_pow_law = Math.pow(unit_l2, FEAS_FALLOFF_EXP) const rand_lerp = l2_pow_law * (1. - FEAS_RND_FRAC) + FEAS_RND_FRAC * Math.random() return rand_lerp Loading Loading @@ -134,16 +141,24 @@ function paintTree() { } }) let cdf = [0.] for (let nodeIdx = 0; nodeIdx < grid.numNodes; nodeIdx++) { cdf.push(cdf[cdf.length - 1] + node_feasibility(nodeIdx)) + 1e-5 } function get_random_unreachable_node() { let node = null while (node == null || algo.labels[node].isReachable() || node_feasibility(node) < 0.5) { node = Math.floor(Math.random() * grid.numNodes) while (node == null || algo.labels[node].isReachable()) { // We should not be getting grid.numNodes, but to be safe we upper bound it. node = Math.min(grid.numNodes - 1, bounds.le(cdf, Math.random() * cdf[cdf.length - 1])) } return node } for (let i = 0; i < N_SOURCES; i++) { algo.addSource(get_random_unreachable_node(), true) } const anim = setInterval(function() { for (let i = 0; i < LBLS_PER_FRAME; ++i) { const result = algo.propagate(true) Loading
webpack/package-lock.json +6 −0 Original line number Diff line number Diff line Loading @@ -822,6 +822,12 @@ "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==", "dev": true }, "binary-search-bounds": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/binary-search-bounds/-/binary-search-bounds-2.0.4.tgz", "integrity": "sha512-2hg5kgdKql5ClF2ErBcSx0U5bnl5hgS4v7wMnLFodyR47yMtj2w+UAZB+0CiqyHct2q543i7Bi4/aMIegorCCg==", "dev": true }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", Loading
webpack/package.json +2 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ "webpack": "^4.25.1", "webpack-bundle-analyzer": "^3.0.3", "webpack-cli": "^3.1.2", "typeface-ubuntu": "^0.0.65" "typeface-ubuntu": "^0.0.65", "binary-search-bounds": "^2.0.4" }, "dependencies": { "@fortawesome/fontawesome": "^1.1.8", Loading