From 884238ce39fd60c636d2c5abba7a5617d9e24b47 Mon Sep 17 00:00:00 2001 From: Rodrigo Morais <58960796+rodigu@users.noreply.github.com> Date: Wed, 6 Apr 2022 17:08:07 -0700 Subject: [PATCH] :white_check_mark: triplet testing - created legacy testing file - compare previous algorithms --- network.ts | 6 +++--- test_legacy.ts | 6 ++++++ tester.ts | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 test_legacy.ts diff --git a/network.ts b/network.ts index fae9492..8896ec6 100644 --- a/network.ts +++ b/network.ts @@ -698,11 +698,11 @@ export class Network { if (triplet.addEdge(k2.edgeBetween(triplet.tip, id)?.args)) if (triplet.close(k2.edgeBetween(triplet.tip, triplet.loop)?.args)) - if ( + if ( triplet_list.every((t) => !t.isSameAs(triplet)) && triplet.is_complete - ) - triplet_list.push(triplet); + ) + triplet_list.push(triplet); }); }); diff --git a/test_legacy.ts b/test_legacy.ts new file mode 100644 index 0000000..e08af2b --- /dev/null +++ b/test_legacy.ts @@ -0,0 +1,6 @@ +import * as nets from "https://deno.land/x/nets@v0.3.2/mod.ts"; +import * as nex from "https://deno.land/x/nets@v0.3.2/extra.ts"; + +const start = Date.now(); +const network = await nex.loadAdjacencyMatrix("./data/networkMatrix.csv"); +console.log(network.triplets().length, Date.now() - start); diff --git a/tester.ts b/tester.ts index 1aa3832..0bdf8e3 100644 --- a/tester.ts +++ b/tester.ts @@ -236,4 +236,8 @@ function generalTesting() { } // compareQuadAlgorithms(nex.genCompleteNetwork(10), true); -randomNetEfficiencyTest(20, { min: 20, max: 120 }, "rand_dense.json"); +// randomNetEfficiencyTest(20, { min: 20, max: 120 }, "rand_dense.json"); + +const start = Date.now(); +const net = await nex.loadAdjacencyMatrix("./data/networkMatrix.csv"); +console.log(net.triplets().length, Date.now() - start);