Example #1
0
        public void Test2(SubwayMap <char> map)

        {
            map.InsertStation('A');
            map.InsertStation('B');
            map.InsertStation('C');
            map.InsertStation('D');
            map.InsertStation('E');
            map.InsertStation('F');
            map.InsertStation('G');
            map.InsertStation('H');

            map.InsertLink('A', 'B', ConsoleColor.Red);
            map.InsertLink('A', 'G', ConsoleColor.Yellow);
            map.InsertLink('A', 'H', ConsoleColor.Blue);

            map.InsertLink('B', 'C', ConsoleColor.Red);

            map.InsertLink('B', 'D', ConsoleColor.Yellow);
            map.InsertLink('B', 'D', ConsoleColor.Green);

            map.InsertLink('C', 'F', ConsoleColor.Red);

            map.InsertLink('F', 'E', ConsoleColor.Red);
            map.InsertLink('F', 'E', ConsoleColor.Yellow);

            map.InsertLink('E', 'D', ConsoleColor.Yellow);
            map.InsertLink('E', 'D', ConsoleColor.Green);


            Console.WriteLine("\nThe graph is populated with Test 2 sample\n\n");
            map.PrintGraph();
        }
Example #2
0
        static void Main(string[] args)
        {
            SubwayMap <char> map  = new SubwayMap <char>();
            Menu             menu = new Menu(map);

            menu.ShowMenu();
        }
Example #3
0
 public Menu(SubwayMap <char> map)
 {
     this.map = map;
 }
Example #4
0
        /// <summary>
        /// ExecuteSelection
        ///
        /// Executes the needed methods for the option
        ///
        /// </summary>
        /// <param name="selection">The option name</param>
        /// <param name="map">The subway map</param>
        public void ExecuteSelection(string selection, SubwayMap <char> map)
        {
            switch (selection)
            {
            case "Add Station":
                AddStation();
                Helper.Wait();
                break;

            case "Add Link":
                AddLink();
                Helper.Wait();
                break;

            case "Remove Link":
                RemoveLink();
                Helper.Wait();
                break;

            case "Find shortest path between two stations":
                ShortestPath();
                Helper.Wait();
                break;

            case "Print the Graph":
                Console.Clear();
                map.PrintGraph();
                Helper.Wait();
                break;

            case "Find the articulation points":
                map.CriticalPoints();
                Helper.Wait();
                break;

            case "Test1":
                Test1(map);
                Helper.Wait();
                break;

            case "Test2":
                Test2(map);
                Helper.Wait();
                break;

            case "Test3":
                Test3(map);
                Helper.Wait();
                break;

            case "Clear Graph":
                this.map = new SubwayMap <char>();
                Console.WriteLine("Graph is cleared");
                Helper.Wait();
                break;

            case "Exit":
                Environment.Exit(1);
                break;

            default:
                Environment.Exit(1);
                break;
            }
        }