Graph Algorithms Visualizer
Type an edge list and see shortest paths, BFS, DFS, topological order or a spanning tree.
Algorithms
Pathfinding Visualizer
Sorting Algorithm Visualizer
Graph Algorithms Visualizer
Questions
How do I type a graph?
One edge per line: "A B" joins A and B, "A B 4" gives the edge a weight of 4, and "A -> B" makes it one way. A name on its own adds a node with no edges. Anything after # is a comment.
When should I use BFS or DFS?
Breadth-first visits nodes in order of how many edges away they are, so it finds the fewest hops. Depth-first follows one branch as far as it goes before backing up, which suits cycle checks and topological order.
What is a topological sort?
An order of the nodes where every arrow points forward, like build steps where each one comes after what it depends on. It only exists for a directed graph with no cycles, and the tool says so if there is a cycle.
What is a minimum spanning tree?
The cheapest set of edges that still connects every node, with no loops. Think of the least cable needed to link some buildings. The tool uses Kruskal's algorithm. If the graph falls apart into pieces, you get one tree per piece.
Why does Dijkstra warn about negative weights?
Dijkstra assumes a path never gets cheaper by adding an edge. A negative weight breaks that, so its answer may not be the shortest. Bellman-Ford handles negative weights.
Related tools
- Pathfinding VisualizerDraw walls and watch A*, Dijkstra, BFS and more find a path, or race two.
- Sorting Algorithm VisualizerWatch quicksort, merge sort and more sort your numbers, and race two side by side.
- JSON DiffCompare two JSON documents and see every added, removed and changed value by path.
- Cron Expression ParserAny cron expression in plain English, with its next five run times.