Example #1
0
        private static async Task FindPathsAsync(long id1, long id2)
        {
#if !ALLOW_CACHE
            var analyzer = new Analyzer(client);
#endif
            Console.WriteLine("请稍后……");
            var sw    = Stopwatch.StartNew();
            var paths = await analyzer.FindPathsAsync(id1, id2);

            sw.Stop();
            Console.WriteLine("找到 {0} 条路径,用时 {1} 。", paths.Count, sw.Elapsed);
            foreach (var g in paths.ToLookup(p => p.Length).OrderBy(g1 => g1.Key))
            {
                Console.WriteLine("{0}-hop:{1} 条。", g.Key - 1, g.Count());
            }
            Console.WriteLine(client.DumpStatistics());
            Console.WriteLine(analyzer.DumpStatistics());
            //Console.WriteLine(analyzer.DumpAlphabet());
#if !ALLOW_CACHE
            //analyzer.Dispose();
#endif
        }