Visualize & Master
Algorithms & Data Structures
Explore classic & modern sorting algorithms, efficient searching techniques, and interactive data structure visualizations — all with real-time step-by-step animation, comparisons, swaps, and Big-O metrics.
BFS — Breadth-First Search
Queue
Distances
| Node | Dist | Parent |
|---|
Result Order
SCC Groups
Distance Matrix
Select an algorithm and press Play to begin.
Graph Algorithms Algorithm Catalog
10 algorithms in this category. Click any card for detailed analysis.
Breadth-First Search
UnstableBFS is a graph traversal algorithm that explores all vertices reachable from a source, visiting neighbors level by level using a FIFO queue.
Depth-First Search
UnstableDFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking, using a LIFO stack.
Dijkstra's Algorithm
UnstableDijkstra's algorithm finds the shortest paths from a source node to all other nodes in a weighted graph with non-negative edge weights using a min-priority queue.
Topological Sort
UnstableTopological Sort (Kahn's algorithm) orders the vertices of a Directed Acyclic Graph (DAG) such that for every directed edge u→v, u appears before v in the ordering.
Prim's Algorithm
UnstablePrim's algorithm finds a Minimum Spanning Tree (MST) for a weighted undirected graph by growing a tree one vertex at a time from an arbitrary start, always adding the cheapest edge that connects a tree vertex to a non-tree vertex.
Kruskal's Algorithm
UnstableKruskal's algorithm finds a Minimum Spanning Tree (MST) by sorting all edges by weight and adding the cheapest edge that does not form a cycle, using the Union-Find data structure.
Bellman-Ford Algorithm
UnstableBellman-Ford finds single-source shortest paths in a weighted graph and, unlike Dijkstra, supports negative edge weights. It works by relaxing all edges V−1 times and then checking for negative cycles.
Kosaraju's SCC
UnstableKosaraju's algorithm finds all Strongly Connected Components (SCCs) of a directed graph in linear time using two passes of DFS: one to order vertices by finish time, and one on the reverse graph to peel off components.
Floyd-Warshall
UnstableFloyd-Warshall computes the shortest paths between every pair of vertices in a weighted graph. It incrementally allows each vertex as an intermediate point and updates an all-pairs distance matrix.
Articulation Points
UnstableAn articulation point (cut vertex) is a vertex whose removal increases the number of connected components in a graph. Tarjan's algorithm finds all articulation points in a single DFS using discovery times and low-link values.
Complexity & Performance Tradeoffs
Side-by-side comparison of Big-O time and space complexity characteristics across graph algorithms.
| Algorithm | Best Time | Average Time | Worst Time | Space Complexity | Stability |
|---|---|---|---|---|---|
| Breadth-First Search | O(V + E) | O(V + E) | O(V + E) | O(V) | Unstable |
| Depth-First Search | O(V + E) | O(V + E) | O(V + E) | O(V) | Unstable |
| Dijkstra's Algorithm | O((V + E) log V) | O((V + E) log V) | O((V + E) log V) | O(V) | Unstable |
| Topological Sort | O(V + E) | O(V + E) | O(V + E) | O(V) | Unstable |
| Prim's Algorithm | O((V + E) log V) | O((V + E) log V) | O((V + E) log V) | O(V) | Unstable |
| Kruskal's Algorithm | O(E log E) | O(E log E) | O(E log E) | O(V) | Unstable |
| Bellman-Ford Algorithm | O(E) | O(VE) | O(VE) | O(V) | Unstable |
| Kosaraju's SCC | O(V + E) | O(V + E) | O(V + E) | O(V) | Unstable |
| Floyd-Warshall | O(V³) | O(V³) | O(V³) | O(V²) | Unstable |
| Articulation Points | O(V+E) | O(V+E) | O(V+E) | O(V) | Unstable |