%3C/text%3E%3C/svg%3E">
💻
💻 Tech & IT

Graph Algorithm Running Time Estimator

Results update as you type.

Your numbers

Understanding the graph algorithm running time estimator — concept and principle

Before running a graph algorithm on a large graph, it helps to know whether it will take milliseconds or months. This estimator multiplies out the textbook complexity of four classic graph algorithms for your vertex count V and edge count E, and divides by an assumed speed to give rough run times.

Running time of four graph algorithmsAt 10⁸ operations a second: BFS/DFS 11 ms, Dijkstra 183 ms, Bellman–Ford 1,000 s, Floyd–Warshall 116 days.V = 100,000, E = 1,000,000 at 10⁸ ops/sBFS / DFSV + E = 1.1 × 10⁶11 msDijkstra(V + E) log V ≈ 1.8 × 10⁷183 msBellman–FordV × E = 10¹¹1,000 sFloyd–WarshallV³ = 10¹⁵116 daysSame graph — from a blink to almost 4 months
On a sparse graph, algorithms linear in V + E finish in milliseconds; V³ takes 116 days.

How it is calculated

The principle

Breadth-first and depth-first search visit each vertex once and look at each edge a constant number of times, so the work is linear in the size of the graph. Dijkstra's algorithm does the same scan but keeps unfinished vertices in a priority queue; with a binary heap, each update costs O(log V). Bellman–Ford handles negative edge weights by relaxing every edge up to V − 1 times, hence V · E. Floyd–Warshall computes the shortest path between every pair of vertices with three nested loops over V, giving V³ regardless of E. The default 10⁸ operations per second is a cautious figure, since graph code often waits on memory.

Worked example

  1. Inputs: V = 100,000, E = 1,000,000, 10⁸ operations per second.
  2. BFS/DFS: 1,100,000 ÷ 10⁸ = 0.011 s = 11 ms.
  3. Dijkstra: log₂ 100,000 ≈ 16.61, so 1,100,000 × 16.61 ≈ 18,270,000 operations → 183 ms.
  4. Bellman–Ford: 10⁵ × 10⁶ = 10¹¹ operations → 1,000 s.
  5. Floyd–Warshall: 10¹⁵ operations → 10⁷ s ÷ 86,400 ≈ 116 days.
How BFS/DFS O(V + E) changes with Operations per secondHow BFS/DFS O changes with Operations pe…010203040502.5e+075e+077.5e+071e+081.25e+081.5e+082e+08Example: 11 msOperations per second
Each point is the calculator re-run with only “Operations per second” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Operations per secondBFS/DFS O(V + E)
2.5e+0744 ms
5e+0722 ms
7.5e+0714.7 ms
1e+0811 ms
1.25e+088.8 ms
1.5e+087.33 ms
2e+085.5 ms

How to read the result

Anything under a second is fine for one query; if you need thousands of queries, multiply accordingly. Here Dijkstra is the clear choice for single-source shortest paths with non-negative weights. Bellman–Ford is only worth its cost when negative weights are present, and its early-exit version often stops long before V − 1 rounds. Floyd–Warshall is practical only up to a few thousand vertices; on sparse graphs, Dijkstra from every vertex is far cheaper (about 1.8 × 10¹² operations here).

Common mistakes

Keep in mind: Estimates are order-of-magnitude only. Real times depend on the graph's structure, the data layout and the implementation, so benchmark on a sample first.

Frequently asked questions

Is a Fibonacci heap faster for Dijkstra?

In theory it gives O(E + V log V), but in practice binary or pairing heaps are usually faster because of lower constants.

What does BFS find that DFS does not?

BFS finds shortest paths by number of edges in unweighted graphs; DFS is better for cycle detection and topological sorting.

Why is Floyd–Warshall still taught?

It is short, handles negative edges, and is efficient for small dense graphs.

Sources: E. W. Dijkstra, "A note on two problems in connexion with graphs", Numerische Mathematik 1, 1959 · R. W. Floyd, "Algorithm 97: Shortest path", Communications of the ACM 5(6), 1962 · T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, MIT Press (graph algorithms)

Checked 8 Nov 2026. Standard formulas and RFC/IEEE definitions, computed locally in your browser — nothing you type is sent anywhere.

💻 All tech & IT tools →🌍 Calculators by country →