public override void Compute() { TLSimilarityMatrix matrix = (TLSimilarityMatrix)Workspace.Load("Matrix"); TLSimilarityMatrix pruned = TLSimilarityMatrixUtil.CreateMatrix(TLSimilarityMatrixUtil.GetTopNLinks(matrix, _config.N)); Workspace.Store("PrunedMatrix", pruned); }
public void GetTopNLinks() { TLLinksList list = TLSimilarityMatrixUtil.GetTopNLinks(sims, 4); #if Verbose Console.WriteLine("TLSimilarityMatrixUtilTest.GetTopNLinks()"); for (int i = 0; i < list.Count; i++) { Console.WriteLine("{0}\t{1}\t{2}", list[i].SourceArtifactId, list[i].TargetArtifactId, list[i].Score ); } #endif Assert.AreEqual(4, list.Count); TLLinksList expected = new TLLinksList(); expected.Add(new TLSingleLink("A", "B*", 10)); expected.Add(new TLSingleLink("A", "E", 9)); expected.Add(new TLSingleLink("A", "F", 8)); expected.Add(new TLSingleLink("A", "C*", 7)); for (int i = 0; i < expected.Count; i++) { Assert.AreEqual(expected[i], list[i]); } }