Example #1
0
 public void GraphOutput(object sender, EventArgs e)
 {
     if (Graph != null)
     {
         OutputOfGraph.View(Graph);
     }
     else
     {
         Console.WriteLine("Error!! Graph doesn't exist!");
     }
 }
Example #2
0
        public void Menu()
        {
            bool exit = false;

            while (!exit)
            {
                Console.WriteLine($"\t\t\tGraph Menu\n" +
                                  $"\t1.Input Graph\n" +
                                  $"\t2.Output Graph\n" +
                                  $"\t3.SearchOfShortestPath(Deijkstra)\n" +
                                  $"\t4.BreadthFirstSearch\n" +
                                  $"\t5.DepthFirstSearch\n" +
                                  $"\t6.InputFromFile\n" +
                                  $"\t7.OutputInFile\n" +
                                  $"\t8.IsGraphDictyledonous\n" +
                                  $"\t9.Close road\n" +
                                  $"\tAnother.Exit\n");

                var keyInfo = Console.ReadKey();

                Console.WriteLine();

                switch (keyInfo.Key)
                {
                case ConsoleKey.D1:
                    InputOfGraph.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D2:
                    OutputOfGraph.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D3:
                    SearchOfPath.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D4:
                    BreadthFirstSearch.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D5:
                    DepthFirstSearch.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D6:
                    InputFromFile.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D7:
                    OutputInFile.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D8:
                    IsGraphDictyledonous.Invoke(this, EventArgs.Empty);
                    break;

                case ConsoleKey.D9:
                    IsRoadsClosed.Invoke(this, EventArgs.Empty);
                    break;

                default:
                    exit = true;
                    break;
                }

                Console.ReadKey();

                Console.Clear();
            }
        }