Skip to content

Interactive Kruskal's Algorithm Visualizer in Java | Learn Minimum Spanning Tree with Graphical and Non-Graphical Modes

Notifications You must be signed in to change notification settings

jadwinder/Kruskal_Algorithm_Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

Kruskal's Algorithm Project

Overview

This project implements Kruskal's Minimum Spanning Tree (MST) algorithm with both graphical and non-graphical modes. It is built in Java (Swing GUI) for visualizing the algorithm’s steps.

Kruskal's algorithm is a classic greedy algorithm used to find a minimum spanning tree in a weighted, undirected graph. It selects edges in order of increasing weight and adds them to the MST if they do not form a cycle.


Features

  • Graphical Visualization:

    • Original graph and MST are displayed side by side.
    • Chosen edges are highlighted in green, rejected edges in red.
    • Step-by-step animation showing the MST construction.
    • Edge weights and node labels are clearly displayed.
  • Non-Graphical Mode:

    • User can input adjacency matrix.
    • Algorithm prints chosen and rejected edges with minimum cost.
  • User-Friendly Interface:

    • Clickable buttons for choosing mode.
    • Auto-scrolling console for selected/rejected edges.

How to Run

  1. Clone the repository:
    git clone https://www.github.com/jadwinder/Kruskal_Algorithm_Visualizer.git
    cd Kruskal_Algorithm_Visualizer
    
    

Some Screenshots

image image image image image

About

Interactive Kruskal's Algorithm Visualizer in Java | Learn Minimum Spanning Tree with Graphical and Non-Graphical Modes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages