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
- BFS/DFS: explore reachability and traversal order.
- Dijkstra: non-negative weights shortest paths.
- MST: minimum total edge weight spanning all nodes.
🌍 Applications
- Routing: networks and maps
- Clustering: MST-based segmentation
- Scheduling: dependency resolution
❓ Frequently Asked Questions
1) Why Dijkstra needs non-negative weights?
Negative edges can break the greedy invariant.
Negative edges can break the greedy invariant.
2) How to handle negatives?
Use Bellman–Ford or Johnson's algorithm.
Use Bellman–Ford or Johnson's algorithm.
3) Prim vs Kruskal?
Prim grows a tree; Kruskal adds safe edges by weight.
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.
BFS finds shortest paths on unweighted graphs; DFS dives deep first.
5) Complexity of Dijkstra?
O((V+E) log V) with a binary heap.
O((V+E) log V) with a binary heap.
6) Multiple shortest paths?
Tie-breaking yields different valid trees/paths.
Tie-breaking yields different valid trees/paths.
7) Directed vs undirected?
Edge orientation changes reachability and path costs.
Edge orientation changes reachability and path costs.
8) Weighted BFS?
Use 0-1 BFS for edges with weights 0 or 1.
Use 0-1 BFS for edges with weights 0 or 1.
9) Dense vs sparse graphs?
Data structure choices affect performance and memory.
Data structure choices affect performance and memory.
10) A* vs Dijkstra?
A* uses a heuristic to guide the search toward the goal faster.
A* uses a heuristic to guide the search toward the goal faster.