b2KIT

Graph Theory Playground

Build graphs with nodes and edges. Run BFS, DFS, Dijkstra, and detect Eulerian/Hamiltonian paths with step-by-step animation.

Tested tool guide Tested browser tools Checked August 16, 2026

What Graph Theory Playground does, with a checked example

Graph Theory Playground lets you arrange vertices, connect them with edges, assign weights where needed, and watch graph algorithms advance one step at a time. It supports breadth-first search, depth-first search, Dijkstra shortest paths, and tests for Eulerian and Hamiltonian paths. The animation helps distinguish visited vertices, the current route, and remaining choices. A common surprise is that BFS or DFS may produce a different valid visitation order when several neighboring vertices are equally eligible.

Worked example

A concrete input and expected output from the current implementation.

Input

Create weighted edges A-B with weight 2, B-C with weight 3, and A-C with weight 10. Run Dijkstra from A to C.

Expected output

Shortest path: A -> B -> C. Total weight: 5.

The route through B has weight 2 + 3 = 5, which is less than the direct A-C edge weight of 10.

How the result is produced

1

Build the graph

Add a vertex for each object and an edge for each relationship you want represented. Edge weights matter to Dijkstra, while BFS and DFS primarily follow connectivity. After choosing an algorithm, supply a starting vertex and, when the operation requires one, a destination. The displayed steps then show how that algorithm progresses through the graph.

2

Interpret each mode

BFS explores outward by increasing edge count, while DFS follows one branch before returning to alternatives. Dijkstra compares accumulated edge weights to find a minimum-weight route when weights are nonnegative. An Eulerian path uses every edge exactly once; a Hamiltonian path visits every vertex exactly once. Those two path tests answer different questions and need not agree.

Good uses

  • Check whether BFS finds a route with fewer edges than a route suggested by a DFS traversal.
  • Compare competing weighted routes and inspect why Dijkstra selects one path over another.
  • Construct a small puzzle or network and test separately for an Eulerian path and a Hamiltonian path.

Limits and checks

  • Traversal order is not generally unique. When several neighbors are available, a different tie order can yield another correct BFS or DFS sequence.
  • Dijkstra's shortest-path guarantee requires nonnegative edge weights. Do not trust a Dijkstra result for negative-weight edges unless the tool explicitly prevents or handles them.
  • A traversal started in one disconnected component cannot reach vertices in another component. An incomplete visitation list does not necessarily mean vertices were omitted incorrectly.

Common questions

Does BFS always return the shortest path?

BFS finds a path using the fewest edges when each edge counts equally. It does not minimize the sum of unequal edge weights. For a graph where edges carry nonnegative costs, use Dijkstra instead. If multiple routes have the same minimum number of edges, BFS may display only one of those equally short routes.

Why can a graph have an Eulerian path but no Hamiltonian path?

The requirements concern different graph elements. An Eulerian path must use every edge once and may revisit vertices. A Hamiltonian path must visit every vertex once and does not have to use every edge. Satisfying the edge-based condition therefore says nothing conclusive about satisfying the vertex-based condition, or vice versa.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools