Free online tool

Shortest Path Teaching Tool

Find the shortest route through a network. Compare the fewest steps with the lowest cost and see how the route is chosen.

Works on your deviceNo account neededGraph JSON / SVG / PNG / CSVOpen workspace ↓

Why can the fewest-hop route differ from the cheapest route?

A direct connection can cost more than several short steps. Choose start and destination nodes to compare Dijkstra’s lowest-cost path with the fewest-hop path. Block unavailable locations, inspect the selected route and settled distances, and export the route with your graph.

Make the connections.

On your device
Import graph JSON

Use directed: true or false, a nodes array with unique IDs, and edges with source and target IDs.

5 nodes · 6 connections

Drag a node to move it. Drag blank space to pan.
261723Village — Starting pointVillageForestForestBridgeBridgeCastleCastleHarbourHarbour

Keyboard: focus a node and use arrow keys to move it; hold Shift for larger steps. Labels and notes are available in the editor below.

Find a route

Hold Command or Control to choose several blocked locations. Start and destination must remain available.

Nodes & notes

Node ID: A

Deleting a node also deletes its connections. Undo restores both. Keep at least one node.

Connections

Weights mean distance for routes and weighted betweenness; they mean strength for PageRank and community detection.

Three simple steps

How to use Shortest Path Teaching Tool

  1. Open a graph project or edit nodes and connections in the workspace.

  2. Explore the graph and choose the relevant analysis or layout controls.

  3. Export the diagram, data tables or an editable project.

Common questions

Good to know

Understand the result.
Keep the original.

Is this tool free, and are my files uploaded?

This tool is free with no account required. The work happens in your browser. Your input and files are not sent to a processing server.

What are the limits and details?

This uses your authored graph and nonnegative edge costs. Directed edges are one-way, and blocked nodes cannot be traversed. The route planner is for graph exercises and game maps; it does not provide real-world street navigation or live travel conditions.

Limits: 500 nodes, 2,000 edges and 500,000 project characters. Expensive operations run in a cancellable 30-second browser worker.