BFS · Dijkstra · MST

Graph Algorithms Visualizer

Generate a random weighted graph and explore traversals and optimal structures. Visualize shortest paths and spanning trees step by step.

🕸️ Graph Canvas
⚙️ Controls

📚 Graph Fundamentals

🌍 Applications

❓ Frequently Asked Questions

1) Why Dijkstra needs non-negative weights?
Negative edges can break the greedy invariant.
2) How to handle negatives?
Use Bellman–Ford or Johnson's algorithm.
3) Prim vs Kruskal?
Prim grows a tree; Kruskal adds safe edges by weight.
4) BFS vs DFS?
BFS finds shortest paths on unweighted graphs; DFS dives deep first.
5) Complexity of Dijkstra?
O((V+E) log V) with a binary heap.
6) Multiple shortest paths?
Tie-breaking yields different valid trees/paths.
7) Directed vs undirected?
Edge orientation changes reachability and path costs.
8) Weighted BFS?
Use 0-1 BFS for edges with weights 0 or 1.
9) Dense vs sparse graphs?
Data structure choices affect performance and memory.
10) A* vs Dijkstra?
A* uses a heuristic to guide the search toward the goal faster.