From 3d2b88edeb252da3acf583d1e080911ef9e71c20 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Thu, 15 Jul 2021 19:29:30 +0200 Subject: [PATCH] fix: inefficient removeDuplicateImplied --- src/MatrixView.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/MatrixView.ts b/src/MatrixView.ts index e0ec4a8e..b92070ce 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -93,17 +93,9 @@ export default class MatrixView extends ItemView { reals: internalLinkObj[], implieds: internalLinkObj[] ): internalLinkObj[] { - // const noDuplicatesImplieds = implieds; - // reals.forEach(real => { - // implieds.forEach((implied, i) => { - // if (implied.to === real.to) { - // noDuplicatesImplieds.slice(i, 1) - // } - // }) - // }); - - const noDuplicates = implieds.filter(implied => !reals.map(real => real.to).includes(implied.to)) - return noDuplicates + + const realTos = reals.map(real => real.to); + return implieds.filter(implied => !realTos.includes(implied.to)) } dfsAllPaths(g: Graph, startNode: string): string[][] {