Graph Algorithm Laboratory
Supercharged graph theory in one live visualizer: Dijkstra & A* shortest paths, Bellman–Ford (negative weights), Floyd–Warshall all-pairs, minimum spanning tree, maximum flow, bipartite matching, travelling-salesman approximation, topological sort, a levelled dependency resolver, plus cycle detection, components / SCC, graph coloring and the adjacency matrix. For wiring, routing, link structure, project planning, network maps and dependency trees.
How to Use
- List the edges, one per line: <code>A B</code> for an edge, or <code>A B 5</code> to give it a weight (distance, cost or capacity). Node names are whatever you type.
- Toggle <strong>Undirected / Directed</strong> — directed edges draw arrows and are required for topological sort and the dependency resolver. Bellman–Ford also accepts <strong>negative</strong> weights.
- Pick an algorithm. Dijkstra, A*, Bellman–Ford, Floyd–Warshall and max-flow take a <strong>source</strong> (and target); TSP takes a start; matching, ordering and structure algorithms run on the whole graph.
- The answer is highlighted on the <strong>force-directed graph</strong> — path / MST / matching / tour edges in pink, components and dependency levels as node colors, distances and orderings as labels — and summarised in text, with an all-pairs distance matrix for Floyd–Warshall.
- The example above (the classic Dijkstra graph) finds <strong>A → E = 20</strong> along A–C–F–E. Try the chips below for Bellman–Ford with a negative edge, bipartite matching, a TSP tour or the dependency resolver.
Algorithms
About the Graph Algorithm Laboratory
Working on everyday maths and number work? The Graph Algorithm Laboratory is a free browser tool that gives you the answer in seconds. Supercharged graph theory in one live visualizer: Dijkstra & A* shortest paths, Bellman–Ford (negative weights), Floyd–Warshall all-pairs, minimum spanning tree, maximum flow, bipartite matching, travelling-salesman approximation, topological sort, a levelled dependency resolver, plus cycle detection, components / SCC, graph coloring and the adjacency matrix. For wiring, routing, link structure, project planning, network maps and dependency trees.
How it works
Put each value in its box and read the answer as you go. Because it recalculates live, you can play with the inputs to see how each one moves the result — handy for checking your own working or planning ahead. Everything happens on your device, so it is fast and private.
Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.
Frequently Asked Questions
What algorithms are included?
<strong>Shortest paths:</strong> Dijkstra, A* (straight-line heuristic), Bellman–Ford (negative weights + negative-cycle detection) and Floyd–Warshall (all-pairs). <strong>Trees, flow & matching:</strong> minimum spanning tree (Kruskal), maximum flow (Edmonds–Karp), maximum bipartite matching and a travelling-salesman approximation. <strong>Ordering & structure:</strong> topological sort (Kahn), a levelled dependency resolver, cycle detection, connected / strongly-connected components (Tarjan), greedy coloring and the adjacency matrix.
When should I use Bellman–Ford or Floyd–Warshall instead of Dijkstra?
<strong>Dijkstra</strong> is fastest but needs non-negative weights. <strong>Bellman–Ford</strong> handles <em>negative</em> edge weights (e.g. rebates, gains) and tells you if there's a negative cycle that makes shortest paths meaningless. <strong>Floyd–Warshall</strong> computes the shortest distance between <em>every</em> pair of nodes at once — handy for routing tables, network diameter, or as the distance metric behind the TSP tour.
What is bipartite matching good for?
A bipartite graph splits into two sides with edges only between them — like jobs↔workers, students↔projects, or slots↔candidates. <strong>Maximum matching</strong> pairs as many as possible with no one double-booked. The lab first checks the graph really is bipartite (no odd cycle), colours the two sides, and highlights the matched pairs.
Is the travelling-salesman result optimal?
It's a fast, near-optimal <strong>approximation</strong>, not a guaranteed optimum (exact TSP is NP-hard). It builds a tour by nearest-neighbour and then improves it with 2-opt swaps, using shortest-path distances so it works even when the graph isn't fully connected edge-to-edge. Great for delivery routes, drilling/cutting order and visiting-every-node planning.
What's the difference between topological sort and the dependency resolver?
Both need a directed acyclic graph where an edge A → B means "A must come before B". <strong>Topological sort</strong> gives one valid linear order. The <strong>dependency resolver</strong> groups the work into <em>levels</em> — each level is everything whose prerequisites are already done, so those items can run in parallel — and if there's a circular dependency it tells you exactly which items are stuck.
Does anything run on a server?
No — the parser, all the algorithms and the visualizer run entirely in your browser. Nothing is uploaded and it works offline.
How do I use the Graph Algorithm Laboratory?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Wiring & network design
Minimum spanning tree for the cheapest layout that connects everything.
Routing & maps
Dijkstra, A*, Bellman–Ford and all-pairs Floyd–Warshall for navigation and routing tables.
Website link structure
Components, cycles and reachability across a link graph.
Project planning
Dependency resolver groups tasks into parallel stages; flags circular blockers.
Assignment & scheduling
Bipartite matching for jobs↔workers, slots↔people.
Delivery & visiting routes
TSP approximation for a short tour that hits every stop.
Last updated: