Graph Algorithm Visualizer

Current Node
Visited Node
Current Edge
Visited Edge
Target Node
Range
Pivot
Skipped

Graph Visualization

Algorithm State

Current Node
-
Actions
0
Current Operation
Waiting to start...

Memory State

Variables
startNode:
-
currentNode:
-
targetNode:
-
queue/stack:
-
Algorithm Specific
No algorithm selected
-
Time & Space Complexity
Time Complexity:
-
Space Complexity:
-
Current Space:
-

Algorithm Code

// Select an algorithm to see its code

Algorithm Step

Select an algorithm and click visualize to see the explanation of each step.

Step 0 of 0

Algorithm Results

Actions
0
Algorithm actions
Time Efficiency
O(V+E)
Worst-case time complexity
Space Usage
O(V)
Auxiliary space complexity

Algorithm Summary

Algorithm Comparison

Algorithm Worst-Case Time Average-Case Time Best-Case Time Space Complexity Description
Breadth-First Search (BFS) O(V+E) O(V+E) O(V+E) O(V) Explores nodes level by level. Uses a queue.
Depth-First Search (DFS) O(V+E) O(V+E) O(V+E) O(V) Explores deeply before backtracking. Uses a stack (implicitly with recursion).
Dijkstra's Algorithm O(E log V) O(E log V) O(E log V) O(V) Finds the shortest paths from a single source node to all other nodes in a weighted graph.
Bellman-Ford Algorithm O(V*E) O(V*E) O(E) O(V) Finds the shortest paths from a single source node to all other nodes in a weighted graph, even with negative edge weights. Detects negative cycles.
Floyd-Warshall Algorithm O(V³) O(V³) O(V³) O(V²) Finds the shortest paths between all pairs of nodes in a weighted graph, including negative edge weights.
Prim's Algorithm O(E log V) O(E log V) O(E) O(V) Finds a minimum spanning tree for a weighted undirected graph. Starts with a single node and expands.
Kruskal's Algorithm O(E log E) O(E log E) O(E) O(V) Finds a minimum spanning tree for a weighted undirected graph. Sorts edges and adds them if they don't create a cycle.