Dijkstra-Visualizer

This Python script provides a visual representation of Dijkstra's algorithm on a graph. It allows users to input the number of nodes, specify the nodes, input the edges with weights, and choose a starting node. The script then visualizes the shortest distances and paths from the chosen starting node using networkx and matplotlib.

Running the code

Make sure you have Python installed on your system. Additionally, install the required libraries using the following command:

pip install networkx
pip install matplotlib

Clone the repository

git clone https://github.com/AnanteshG/Dijkstra-Visualizer.git
cd your-repository

Navigate to Repository Directory

cd your-repository

Run the script

python dijkstra_visualizer.py

Input Graph details

Follow the on-screen prompts to input the graph details:

  • Enter the number of nodes
  • Specify the name of each node
  • Enter the number of edges
  • Provide edge details in the format: source, destination, value

Choose a starting node

Enter the starting node for Dijkstra's algorithm when prompted. The script will then visualize the process and display the shortest distances and paths from the chosen starting node.

Example Graphs

Example-1 Example-2

Contributing

Feel free to contribute to the project by opening issues or submitting pull requests. Any contributions are welcome!