Skip to main content
ProductsDesktop toolsTASTECADDrawing reviewTASTEFILESFile managementTASTEFTPFile transferTASTESSHRemote workspaceTASTEZIPCompression and extractionTASTEWINMFile managementDeveloper toolsTASTECODERust integrated development environmentTASTESTUDIOIntegrated development and test environmentTASTEETLData integration (ETL)ServersTASTEREMOTERemote desktop serverTASTEGEOGeospatial serverTASTEMAILMail workspaceInvestingTASTESTOCKStock auto-trading desktop appGet startedDownloadsDocumentationBuyAll products
Marketplace
News
TechNewsToday's dev newsDeveloper docsProgramming languagesRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp & desktop frameworksTauriFlutterReact NativeElectronAlgorithmsAlgorithm basicsCore algorithmsAdvanced algorithmsPractical algorithms
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcaseCommunity guide
Work with usTech transferWebsite buildDesktop app buildRelease and payment pipelineSales partnerContact
ServicesRemote desktopCustom installer packages
TASTEDEV
Products

Desktop tools

TASTECADComplex drawings, opened with easeTASTEFILESJust the files you need, as fast as possibleTASTEFTPThe tidiest path for your filesTASTESSHA stronger link between you and your serversTASTEZIPPack faster, unpack saferTASTEWINMA keyboard-first file manager with two panes

Developer tools

TASTECODEEdit, build, debug and test Rust apps in one windowTASTESTUDIOFrom editing to remote tests and approved AI fixesTASTEETLMove data while you watch the values

Servers

TASTEREMOTEA remote desktop you run on your own serverTASTEGEORebuilding a GeoServer-compatible geospatial server in RustTASTEMAILTake back control of your email

Investing

TASTESTOCKStock auto-trading that follows the rules you set: when, and what

Get started

DownloadsLatest builds of every productDocsHow to use each productBuySubscriptions and perpetual licencesAll productsEvery product at a glance
All products
MarketplaceNews
Tech

News

Today's dev newsOfficial announcements on languages, frameworks, GitHub and AIDeveloper docsGuides to languages, frameworks and algorithms

Programming languages

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App & desktop frameworksTauriFlutterReact NativeElectron

Algorithms

Algorithm basicsComplexity analysis · Sorting · Searching · Basic data structures · Trees and heapsCore algorithmsGraph traversal · Shortest paths & minimum spanning trees · Dynamic programming · Greedy algorithms · Divide and conquer · BacktrackingAdvanced algorithmsString algorithms · Math and number theory · Bit manipulation · Segment trees · Union-findPractical algorithmsCoding interview strategy · LRU cache · Rate limiting · Consistent hashing
All development docs
Community
ProjectsDiscover builders and their workDevelopment logsDecisions and lessons learnedPromptsReusable instructionsAI tool issuesProblems and workarounds for Claude, Codex, GeminiShowcaseFinished resultsCommunity guideHow we build in the open
Work with us
Tech transferNative apps in Rust and eguiWebsite build10 languages, accounts, docs and downloadsDesktop app buildRust and egui, no WebViewRelease and payment pipelineSigning, MSI, deb, rpm, AppImage, hashesSales partnerRecommend us and earn 30%ContactBuilds, partnerships and investment
Services
Remote desktopReach your computer from a browserCustom installer packagesOnly the features you need, settings preloaded
Buy
EN
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Log in
Log in
TASTEDEV

From small tools to better development.

support@tastedev.netSupport TASTEDEV
ProductsProduct lineupBuyDocsDownloadsMarketplaceSupport
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcase
PoliciesAbout usPrivacy policyTerms of serviceSubscription termsRefund policyCommunity guidelines
AccountLog inSign up
Visitors
Today
Yesterday
Total views
Company
GXSOFT
Representative
CHOI YOUNG GU
Business registration number
853-44-00368
Address
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Phone
+82-10-4404-1523
Email
whitecalvin@tastedev.net
Privacy officer
CHOI YOUNG GU

© 2026 TASTEDEVProduct information is based on verified development sources.Released · improving

Developer docs
Shortest paths & minimum spanning trees
Shortest paths & minimum spanning treesReference implementationStep-by-step guideOfficial docs and resourcesDiscussionsComments

Other algorithms

Algorithm basics5
Complexity analysisSortingSearchingBasic data structuresTrees and heaps
Core algorithms5
Graph traversalDynamic programmingGreedy algorithmsDivide and conquerBacktracking
Advanced algorithms5
String algorithmsMath and number theoryBit manipulationSegment treesUnion-find
Practical algorithms4
Coding interview strategyLRU cacheRate limitingConsistent hashing

Algorithm

Shortest paths & minimum spanning trees

Find shortest paths with Dijkstra, Bellman-Ford and Floyd-Warshall, and build minimum spanning trees with Kruskal and Prim.

Start the guideDiscussions

A shortest-path problem asks for the path of least total weight between vertices of a weighted graph. A minimum spanning tree (MST) is the cheapest set of edges that connects every vertex of an undirected graph without forming a cycle. The core algorithms of this topic are Dijkstra, Bellman-Ford, Floyd-Warshall, 0-1 BFS, Kruskal and Prim.

These algorithms run inside map navigation, network routing protocols such as OSPF and RIP, game path finding, cable and pipe layout, and clustering. They are also interview staples, because they test whether you can model a problem as a graph and pick the algorithm that fits the weights: negative or not, only 0 and 1, sparse or dense.

Get comfortable with BFS and priority queues (heaps) first. Then learn relaxation, the operation every shortest-path algorithm shares, and trace Dijkstra by hand on a small graph. Next, see why negative edges call for Bellman-Ford, implement Kruskal with union-find, and finish with practice problems that run Dijkstra on an expanded state graph.

On this page

  1. Highlights
  2. Where it is used
  3. Reference implementation
  4. Step-by-step guide
  5. Official docs and resources
  6. Discussions
  7. Comments

Highlights

Relaxation

Every shortest-path algorithm is built on relaxation, checking whether going through u gives a shorter route to v. The algorithms differ only in the order they relax edges.

Dijkstra with a heap

With non-negative weights, a binary heap pops and settles the closest vertex each time, giving all single-source distances in O((V + E) log V).

Negative edges and all pairs

Bellman-Ford accepts negative edges and detects negative cycles; Floyd-Warshall computes the distance between every pair of vertices in O(V^3).

Greedy MSTs

Kruskal adds edges from lightest to heaviest and uses union-find to avoid cycles; Prim grows one tree by its cheapest outgoing edge. The cut property makes both correct.

Where it is used

  • Map routing and navigation
  • Network routing protocols (OSPF, RIP)
  • Network design for cables and pipes
  • Game path finding and clustering

Reference implementation

Dijkstra with a heap

heapq pops (distance, vertex) pairs in order of distance, and a popped pair whose distance is larger than the recorded one is stale and skipped. When a neighbor's distance improves, the code updates it and pushes a new pair. Running python dijkstra.py prints the shortest distances from A: {'A': 0, 'B': 3, 'C': 1, 'D': 4}.

dijkstra.py

import heapq


def dijkstra(graph, source):
    dist = {source: 0}
    heap = [(0, source)]
    while heap:
        d, u = heapq.heappop(heap)
        if d > dist[u]:
            continue  # stale entry
        for v, w in graph[u]:
            nd = d + w
            if nd < dist.get(v, float("inf")):
                dist[v] = nd
                heapq.heappush(heap, (nd, v))
    return dist


graph = {
    "A": [("B", 4), ("C", 1)],
    "B": [("D", 1)],
    "C": [("B", 2), ("D", 5)],
    "D": [],
}
print(dijkstra(graph, "A"))  # {'A': 0, 'B': 3, 'C': 1, 'D': 4}
python dijkstra.py

Step-by-step guide

Six chapters that take you from installation to the core ideas of Shortest paths & minimum spanning trees.

  1. Concepts
  2. How it works
  3. Implementation
  4. Complexity
  5. Practice problems
  6. Real-world use

Official docs and resources

  • Officialheapq — Heap queue algorithm
  • OfficialNetworkX: Shortest Paths
  • LearnDijkstra Algorithm (cp-algorithms)
  • LearnMinimum spanning tree - Kruskal with Disjoint Set Union (cp-algorithms)
  • LearnVisuAlgo: Single-Source Shortest Paths
  • ReferenceDijkstra's algorithm
  • ReferenceBellman–Ford algorithm
  • ReferenceMinimum spanning tree

Discussions

Start a discussion

Ask questions, share experience and trade opinions about Shortest paths & minimum spanning trees.

No discussions yet. Start the first one.

0 comments

Top commentsNewest first

Sign in · Sign in to leave a comment.