Skip to content

I developed the Dijkstra's Shortest Path Visualization as part of a university assignment. This project was a great opportunity to enhance my knowledge of Object-Oriented Programming (OOP). While there is potential for further improvements, I do not plan to continue its development at this time.

Notifications You must be signed in to change notification settings

sinakhaksar/Dijkstra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dijkstra's Shortest Path Visualization

This Python program demonstrates Dijkstra's algorithm for finding the shortest path in a graph. It uses NetworkX and Matplotlib for visualization.

Features

  • Graph Representation: Adjacency matrix.
  • Dijkstra's Algorithm: Computes the shortest path.
  • Visualization: Highlights the shortest path in red.

Installation

Install the required libraries using pip:

pip install -r requirements.txt

Usage

  • Clone the repository or copy the code.
  • Run the program:
python dijkstra_visualization.py
  • Enter the source and destination nodes (A-I) when prompted.

Code Summary

Graph Class

  • Initialization: Sets up the graph with a specified number of vertices.
  • Dijkstra's Algorithm: Computes shortest paths.
  • Visualization: Displays the graph with the shortest path highlighted.

Main Function

  • Initializes the graph.
  • Takes user input for source and destination.
  • Runs Dijkstra's algorithm.
  • Visualizes the graph.

Example

$ python dijkstra_visualization.py
Available nodes:
0: A
1: B
2: C
3: D
4: E
5: F
6: G
7: H
8: I
Enter the source node (A - I): A
Enter the destination node (A - I): E
Shortest Path from A to E:
A -> H -> G -> F -> E
The weight is: 21

Graph Visualization Example

About

I developed the Dijkstra's Shortest Path Visualization as part of a university assignment. This project was a great opportunity to enhance my knowledge of Object-Oriented Programming (OOP). While there is potential for further improvements, I do not plan to continue its development at this time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages