Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use C# to solve this needs to create a subway map public enum Colour (RED, YELLOW, GREEN, ... } // For example class Node

Please use C# to solve this

needs to create a subway map

image text in transcribed

public enum Colour (RED, YELLOW, GREEN, ... } // For example class Node { public station Connection {get; set;} // Adjacent station (connection) public Colour Line {get; set;} // Colour of its subway line public Node Next {get; set;} // Link to the next adjacent station (Node) public Node (Station connection, Colour c, Node next) { ... } (2%) } class Station public string Name {get; set;} // Name of the subway station public bool visited {get; set;} // Used for depth-first and breadth-first searches public Node E {get; set;} // Linked list of adjacent stations public station (string name) {...} // Station constructor (2%) } class Subway Map { private List S; // List of stations public Subway Map() {...} // Subway Map constructor (2%) public int FindStation (string name) {...} public void Insert Station (string name) {...} // Duplicate station names are not allowed (4%) public void RemoveStation (string name) {...} (16%) public void InsertConnection (string name1, string name2, Colour c) {...} (8%) public void RemoveConnection (string name1, string name2, Colour c) {...} (8%) 3. } Task 1: Implement each of the methods above, keeping in the mind the following requirements. 1. Each subway connection (edge) is undirected. 2. Each subway connection is coloured as part of a subway line. 3. An adjacent pair of subway stations may have multiple subway connections differentiated by colour. 4. Each subway station (vertex) stores its connections (edges) to adjacent stations in a linked list. Task 2: Using a breadth-first search, implement a method called FastestRoute (from, to) which outputs the shortest sequence of subway stops (including transfers) between two given stations. (16%) Task 3: Using a depth-first search, implement a method called CriticalConnections () which outputs each connection (edge) which breaks the subway map into two parts if it is removed. (16%) Task 4: Implement a main program to create your own subway map and to drive your test cases. (10%) public enum Colour (RED, YELLOW, GREEN, ... } // For example class Node { public station Connection {get; set;} // Adjacent station (connection) public Colour Line {get; set;} // Colour of its subway line public Node Next {get; set;} // Link to the next adjacent station (Node) public Node (Station connection, Colour c, Node next) { ... } (2%) } class Station public string Name {get; set;} // Name of the subway station public bool visited {get; set;} // Used for depth-first and breadth-first searches public Node E {get; set;} // Linked list of adjacent stations public station (string name) {...} // Station constructor (2%) } class Subway Map { private List S; // List of stations public Subway Map() {...} // Subway Map constructor (2%) public int FindStation (string name) {...} public void Insert Station (string name) {...} // Duplicate station names are not allowed (4%) public void RemoveStation (string name) {...} (16%) public void InsertConnection (string name1, string name2, Colour c) {...} (8%) public void RemoveConnection (string name1, string name2, Colour c) {...} (8%) 3. } Task 1: Implement each of the methods above, keeping in the mind the following requirements. 1. Each subway connection (edge) is undirected. 2. Each subway connection is coloured as part of a subway line. 3. An adjacent pair of subway stations may have multiple subway connections differentiated by colour. 4. Each subway station (vertex) stores its connections (edges) to adjacent stations in a linked list. Task 2: Using a breadth-first search, implement a method called FastestRoute (from, to) which outputs the shortest sequence of subway stops (including transfers) between two given stations. (16%) Task 3: Using a depth-first search, implement a method called CriticalConnections () which outputs each connection (edge) which breaks the subway map into two parts if it is removed. (16%) Task 4: Implement a main program to create your own subway map and to drive your test cases. (10%)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions