This is a best path finder for Cairo Metro Stations implemented using the Breadth First Search (BFS) Algorithm
Java
Cairo Metro Stations (Breadth First Search)
This is a best path finder for Cairo Metro Stations implemented using the Breadth First Search (BFS) Algorithm.
It Consists of 4 Classes :
Metro Station : Used to describe a single station.
StationsUtil : A util class that contatins methods to get Station names or Station neighbours.
TreeNode : This is a wrapper class that holds stations while searching.
BreadthFirstSearch : This is the class which contains the algorithm.
Each Metro Station is composed of three fields :
Station Name
Srtation Code
Neighbour Stations
Inputs and Outputs
The input is basicly 2 integers representing the startStationCode and endStationCode, All available codes are shown in tables below, if a wrong code is used a NullPointerException with message "Wrong Station Code" will be throwed.
The Output is a Stack of MetroStation class representing the path from the Start station to the End station, and the stack's size represents the number of stations in this path.