This project demonstrates the use of a Doubly Linked List (DLL) data structure to simulate a Train Route Management System.
It allows users to insert, delete, search, and navigate between railway stations interactively.
The Train Route Management System is implemented using Python classes to model a doubly linked list where:
- Each node represents a train station.
- Stations are linked in both forward and backward directions, allowing traversal from one station to the next or previous station easily.
This project helps understand:
- How Doubly Linked Lists work internally.
- How to manage dynamic data insertion, deletion, and navigation in real time.
- The concept of data abstraction and object-oriented programming in Python.
β
View the entire train route
β
Insert a new station (anywhere in the route)
β
Delete a station
β
Search for a station by name
β
Display the next or previous station
β
Fully menu-driven console interface
The program uses a Doubly Linked List, which consists of:
Nodeclass β representing each station (withprev,next, andstation_nameattributes)DoublyLinkedListclass β providing all route operations
Each station is connected in both directions, making traversal easy in either direction.
- The system starts with a few default stations (
A,B,C,D). - A menu-driven interface allows users to:
- Insert a new station after any existing station.
- Delete any station by name.
- Search for a specific station.
- View next and previous stations.
- The program continues running until the user chooses to exit.
Node: Represents each station in the route.DoublyLinkedList: Manages route operations (insert, delete, search, display, etc.).
The main() function provides an interactive CLI menu for user input and control flow.
- Open the
.ipynbfile in Google Colab or Jupyter Notebook. - Run all cells sequentially.
- Interact using the console prompts.
- Save the notebook as a Python file (
.py):