Exemple #1
0
        private void SearchGraphAction(object sender, RoutedEventArgs e)
        {
            var NeedleValue = NeedleTxt.Text;
            var DepthValue  = DepthTxt.Text;
            var NeedleNode  = ListOfNodes.FirstOrDefault(x => x.IsEqual(NeedleValue)) ?? new Node <string>(NeedleValue);

            int.TryParse(DepthValue, out int Depth);

            var Algorithms = AlgorithmFactory <string> .GetAlgorithms();

            SearchResult.Clear();

            foreach (var Algorithm in Algorithms)
            {
                var watch  = System.Diagnostics.Stopwatch.StartNew();
                var Result = Algorithm.Search(Root, NeedleNode, Depth);
                watch.Stop();
                var TimeSpan = watch.Elapsed;
                DisplayResult(Algorithm.Name, TimeSpan, Result.Item2);
            }
        }