using System; using System.Collections.Generic; using System.IO; using System.Linq; using ZeroLevel.HNSW; using ZeroLevel.Services.Serialization; namespace temp { class Program { static void Main(string[] args) { SmallWorld world; using (var ms = new FileStream(@"F:\graph_test.bin", FileMode.Open, FileAccess.Read, FileShare.None)) { world = SmallWorld.CreateWorldFrom(NSWOptions.Create(6, 12, 100, 10, Metrics.L2Euclidean, true, true, selectionHeuristic: NeighbourSelectionHeuristic.SelectSimple), ms); } var test_vectors = new List(); using (var ms = new FileStream(@"F:\test_vectors.bin", FileMode.Open, FileAccess.Read, FileShare.None)) { using (var reader = new MemoryStreamReader(ms)) { var count = reader.ReadInt32(); for (int i = 0; i < count; i++) { test_vectors.Add(reader.ReadFloatArray()); } } } Forward(world, test_vectors); Console.WriteLine("Completed"); } static void Forward(SmallWorld world, List test_vectors) { int K = 10; foreach (var v in test_vectors) { var result = world.Search(v, K); Console.WriteLine(result.Count()); } } } }