diff --git a/.gitignore b/.gitignore index 8601a29..aa06c47 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ coverage *~ #* *.swp +/nbproject/private/ diff --git a/examples/matrix.js b/examples/matrix.js index 00970bd..fcb12ba 100644 --- a/examples/matrix.js +++ b/examples/matrix.js @@ -101,6 +101,15 @@ function matrix(json) { return nodes.map(function(n) { return n.spectral; }); } + + function computeNN2OPT() { + var order = leafOrder(adjacency); + + order.forEach(function(lo, i) { + nodes[i].leafOrder = lo; + }); + return nodes.map(function(n) { return n.leafOrder; }); + } // Precompute the orders. var orders = { @@ -114,7 +123,8 @@ function matrix(json) { leafOrderDist: computeLeaforderDist, barycenter: computeBarycenter, rcm: computeRCM, - spectral: computeSpectral + spectral: computeSpectral, + nn2opt: computeNN2OPT }; // The default sort order. @@ -240,6 +250,11 @@ function matrix(json) { order("leafOrderDist"); //d3.select("#order").property("selectedIndex", 4); } + else if (currentOrder == 'nn2opt') { + orders.nn2opt = computeNN2OPT; + order("nn2opt"); + //d3.select("#order").property("selectedIndex", 4); + } // leafOrder.forEach(function(lo, i) { // nodes[lo].leafOrder = i; diff --git a/examples/miserables/index.html b/examples/miserables/index.html index 5d5f86a..14664a6 100644 --- a/examples/miserables/index.html +++ b/examples/miserables/index.html @@ -47,6 +47,7 @@

Les Misérables Co-occurrence

+

Distance: