Graph Algorithms Visulisations


DFS

DFS is a fundamental graph traversal algorithm that systematically explores vertices and edges, effectively traversing through the depths of the graph. Its recursive nature allows for straightforward implementation, making it a popular choice for various tasks such as cycle detection, topological sorting, and finding connected components.

BFS

In contrast to DFS, BFS traverses a graph level by level, exploring neighbors of a vertex before moving to its neighbors' neighbors. This characteristic lends itself well to finding shortest paths in unweighted graphs, determining connectivity, and solving puzzles like finding the shortest path in a maze.

Kruskal

Kruskal's algorithm addresses the problem of finding a minimum spanning tree in a weighted graph. By iteratively selecting edges in ascending order of weight while avoiding cycles, Kruskal's algorithm constructs a minimum spanning tree efficiently, making it a cornerstone in network design, clustering, and optimization problems.

Prim

Similar to Kruskal's algorithm, Prim's algorithm also tackles the minimum spanning tree problem. However, it takes a different approach by growing the tree from an arbitrary starting vertex, iteratively adding the shortest edge that connects the growing tree to an unvisited vertex. This greedy strategy ensures the construction of a minimum spanning tree and finds applications in network design, routing, and clustering.