<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Topological Sort on BenzHub</title><link>https://benzhub.github.io/tags/topological-sort/</link><description>Recent content in Topological Sort on BenzHub</description><generator>Hugo</generator><language>zh-TW</language><lastBuildDate>Sat, 11 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://benzhub.github.io/tags/topological-sort/index.xml" rel="self" type="application/rss+xml"/><item><title>拓撲排序 — Kahn's BFS 與 DFS 雙解法完整教學 | 資料結構與演算法</title><link>https://benzhub.github.io/post/javascript/data-structures--algorithms/028-topological-sort/</link><pubDate>Sat, 11 Jul 2026 00:00:00 +0000</pubDate><guid>https://benzhub.github.io/post/javascript/data-structures--algorithms/028-topological-sort/</guid><description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;拓撲排序（Topological Sort）&lt;/strong&gt; 是對 &lt;strong&gt;有向無環圖（DAG）&lt;/strong&gt; 節點進行線性排序的技術，確保每條有向邊 &lt;code&gt;u → v&lt;/code&gt; 中，&lt;code&gt;u&lt;/code&gt; 永遠出現在 &lt;code&gt;v&lt;/code&gt; 之前。從大學選課的先修規劃，到 npm 套件的依賴安裝順序，背後都是拓撲排序在默默運作。本文完整介紹 &lt;strong&gt;Kahn&amp;rsquo;s Algorithm（BFS）&lt;/strong&gt; 與 &lt;strong&gt;DFS 後序反轉法&lt;/strong&gt; 雙解法，並搭配環偵測與 LeetCode 實戰題解。&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>