This project aims to facilitate efficient route finding within a network of charging stations for Electric Vehicles (EVs). It utilizes graph theory principles and Dijkstra's algorithm to determine the shortest path from a given starting point to each charging station, offering recommendations for the most efficient route based on distance and other relevant factors.
-
Install Python:
- Ensure Python is installed on your system. If not, download and install it from python.org.
-
Install Required Libraries:
- Open a terminal or command prompt and run:
pip install networkx matplotlib
- Open a terminal or command prompt and run:
-
Download Data File:
- Save your CSV data file (
data.csv
) in the same directory as your Python script.
- Save your CSV data file (
-
Run the Script:
- Open a terminal or command prompt.
- Navigate to the directory containing your Python script (
Project.py
) and the CSV data file.
-
Execute the Script:
- Run the Python script:
python Project.py
- Run the Python script:
-
Follow the Prompts:
- Enter the current point (between A to W) when prompted.
- The script will display the graph with charging stations highlighted and recommend the most efficient route considering the shortest distance to the stations.
- Graph Construction: Constructs a weighted directed graph from the provided data file, representing nodes and edges with distances.
- Routing Algorithm: Implements Dijkstra's algorithm to find the shortest path from the starting node to each charging station.
- Route Recommendation: Analyzes computed paths to recommend the most efficient route to a charging station based on total distance.
- Graph Visualization: Utilizes NetworkX and Matplotlib to visualize the network graph, highlighting charging stations for better understanding.
- User Interaction: Provides a user-friendly interface prompting for the current node and displaying recommended routes.
-
Data Preparation:
- Recorded node and edge information, along with distances between nodes.
- Created a CSV file to represent the network data.
- Loaded CSV data for interpretation in Python.
-
Graph Visualization:
- Utilized NetworkX and Matplotlib libraries to visualize the graph.
- Differentiated charging stations with distinct colors for clarity.
- Labeled edge attributes, such as weight (distance), for better comprehension.
-
Dijkstra's Algorithm Implementation:
- Implemented Dijkstra's algorithm to find the shortest path to each charging station from a given origin node.
- Recorded paths, visited nodes, and distances traveled during iteration.
- Calculated shortest distance and constructed the path to the charging station.
-
Efficiency Calculation:
- Iterated through the list of EV stations to calculate the shortest path and total distance using Dijkstra's algorithm.
- Recommended the shortest and nearest station based on calculated distances.
-
Main Functionality:
- Executed the display function.
- Prompted user input for the current node and displayed paths to each station, followed by recommending the best station to visit.