Graph Algorithms Visualizer

Representations, Traversals, Shortest Paths & MST - Step through each algorithm

Graph Representations


      
Node
Highlighted
Edge list: all E edges as pairs. Space: Θ(E). Adj(v): O(E). Access edge v-w: O(E).
Click Next to explore

      
V×V boolean array. Space: Θ(V²). Access edge: O(1). Adj(v): O(V).
Click Next to explore

      
Vertex-indexed array of lists. Space: Θ(V+E). Adj(v): O(degree(v)).
Click Next to explore

Depth-First Search


    
Unvisited
Current
Visited
Click "Run DFS" to start depth-first search from vertex 0.
Step 0 / 0

Breadth-First Search


    
Unvisited
Current
In Queue
Visited
Click "Run BFS" to start breadth-first search from vertex 0.
Step 0 / 0

Dijkstra's Algorithm


    
In Q
Current
Done
Click "Run Dijkstra" to find shortest paths from vertex A.
Step 0 / 0

Prim's MST


    
Not in tree
In tree
Considering
Click "Run Prim's" to find the minimum spanning tree starting from vertex A.
Step 0 / 0