[{"data":1,"prerenderedAt":10047},["ShallowReactive",2],{"nav:algorithms":3,"lesson:\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs":374,"course-wordcounts":9915,"ref-card-index":9971},[4,28,50,71,120,152,205,230,286,306,331,352],{"module":5,"moduleNumber":6,"slug":7,"lessons":8},"Foundations",1,"foundations",[9,15,21],{"title":10,"path":11,"lessonNumber":6,"topics":12,"summary":14},"What Is an Algorithm?","\u002Falgorithms\u002Ffoundations\u002Fwhat-is-an-algorithm",[5,13],"Correctness & Induction","An algorithm is a finite, mechanical recipe that transforms inputs into outputs. We pin down what counts as an algorithm, how we write one down, and the three things we always ask of it: is it correct, is it fast, and can we prove it.\n",{"title":16,"path":17,"lessonNumber":18,"topics":19,"summary":20},"Asymptotic Analysis","\u002Falgorithms\u002Ffoundations\u002Fasymptotic-analysis",2,[16],"We measure an algorithm's running time as a function of its input size, then strip away machine-specific constants and lower-order terms to compare algorithms cleanly. This lesson defines the RAM model and the $O$, $\\Omega$, $\\Theta$, $o$, and $\\omega$ notations, and shows how to read the cost of loops off the page.\n",{"title":22,"path":23,"lessonNumber":24,"topics":25,"summary":27},"Recurrences and the Master Theorem","\u002Falgorithms\u002Ffoundations\u002Frecurrences",3,[26],"Recurrences","Recursive and divide-and-conquer algorithms describe their own running time with a recurrence: $T(n)$ in terms of $T$ on smaller inputs. We solve recurrences three ways — drawing the recursion tree, guessing-and-verifying by induction, and applying the Master Theorem — using merge sort as the running example.\n",{"module":29,"moduleNumber":18,"slug":30,"lessons":31},"Divide & Conquer","divide-and-conquer",[32,38,44],{"title":33,"path":34,"lessonNumber":6,"topics":35,"summary":37},"Divide and Conquer & Mergesort","\u002Falgorithms\u002Fdivide-and-conquer\u002Fmergesort",[29,36],"Comparison Sorting","Divide and conquer breaks a problem into smaller copies of itself, solves them recursively, and stitches the answers together. We meet the paradigm through mergesort — its merge step, its loop-invariant proof, and the recursion tree that pins its cost at $\\Theta(n\\log n)$ — then glimpse Karatsuba multiplication as a second example of the same idea.",{"title":39,"path":40,"lessonNumber":18,"topics":41,"summary":43},"Quicksort","\u002Falgorithms\u002Fdivide-and-conquer\u002Fquicksort",[36,42],"Probabilistic Analysis","Quicksort sorts in place by partitioning around a pivot and recursing on each side. We give Lomuto and Hoare partitioning with a correctness invariant, see why a bad pivot costs $\\Theta(n^2)$ while a balanced one gives $\\Theta(n\\log n)$, and prove that randomizing the pivot makes the expected cost $\\Theta(n\\log n)$ on every input.",{"title":45,"path":46,"lessonNumber":24,"topics":47,"summary":49},"Linear-Time Selection","\u002Falgorithms\u002Fdivide-and-conquer\u002Fselection",[48,29],"Order Statistics","Finding the $k$-th smallest element looks like it should require sorting, but it does not. Quickselect adapts quicksort's partition to recurse on just one side, achieving expected $O(n)$. The median-of-medians algorithm guarantees a good pivot with the groups-of-five trick, pushing the worst case down to a provable $O(n)$.",{"module":51,"moduleNumber":24,"slug":52,"lessons":53},"Sorting & Order Statistics","sorting",[54,60,65],{"title":55,"path":56,"lessonNumber":6,"topics":57,"summary":59},"Heaps and Heapsort","\u002Falgorithms\u002Fsorting\u002Fheaps-and-heapsort",[58,36],"Heaps","A binary heap is a tree we store flat in an array, with index arithmetic standing in for pointers. We build the max-heap property bottom-up in $O(n)$ time, sort in place in $\\Theta(n\\log n)$ by repeatedly extracting the maximum, and reuse the same structure to implement a priority queue.",{"title":61,"path":62,"lessonNumber":18,"topics":63,"summary":64},"Lower Bounds for Comparison Sorting","\u002Falgorithms\u002Fsorting\u002Fsorting-lower-bounds",[36],"Every sort we have seen runs in $\\Omega(n\\log n)$, and that is no accident. Modeling a sort as a decision tree of comparisons, we show any such tree must have $n!$ leaves, forcing height $\\ge \\log_2(n!) = \\Omega(n\\log n)$ — a worst-case bound no comparison sort can ever beat.",{"title":66,"path":67,"lessonNumber":24,"topics":68,"summary":70},"Sorting in Linear Time","\u002Falgorithms\u002Fsorting\u002Flinear-time-sorting",[69],"Linear-Time Sorting","The $\\Omega(n\\log n)$ barrier only binds algorithms that compare. By instead using keys as array indices we slip past it: counting sort runs in $\\Theta(n+k)$ and is stable, radix sort layers it digit by digit, and bucket sort averages $\\Theta(n)$ on uniform data. We see exactly when each applies.",{"module":72,"moduleNumber":73,"slug":74,"lessons":75},"Data Structures",4,"data-structures",[76,82,88,93,99,105,113],{"title":77,"path":78,"lessonNumber":6,"topics":79,"summary":81},"Elementary Data Structures","\u002Falgorithms\u002Fdata-structures\u002Felementary-structures",[80],"Linear Structures","Every container is built one of two ways: **contiguous** in an array, or **linked** through pointers. We trade cache-friendly random access against $O(1)$ splicing, derive the **amortized $O(1)$** append of a doubling dynamic array, and assemble the two ordered access disciplines — the LIFO **stack** and the FIFO **queue** (with its generalization, the **deque**) — on top of both.",{"title":83,"path":84,"lessonNumber":18,"topics":85,"summary":87},"Hash Tables","\u002Falgorithms\u002Fdata-structures\u002Fhash-tables",[86],"Hashing","A hash table implements the dictionary — insert, search, delete — in expected $O(1)$ time by scattering keys across an array with a hash function. We build up from direct addressing, handle collisions by chaining and by open addressing, analyze the load factor $\\alpha$, and see how universal hashing earns its expected-time guarantee against every input.",{"title":89,"path":90,"lessonNumber":24,"topics":91,"summary":92},"Binary Search Trees","\u002Falgorithms\u002Fdata-structures\u002Fbinary-search-trees",[89],"A binary search tree keeps keys ordered so that every operation follows a single root-to-leaf path. We state the BST property, give search and insert, find minimum, maximum, and successor, see that an inorder walk emits the keys in sorted order, and confront the catch — every operation costs $O(h)$, and a carelessly built tree degrades to height $h = \\Theta(n)$, motivating balance.",{"title":94,"path":95,"lessonNumber":73,"topics":96,"summary":98},"AVL Trees","\u002Falgorithms\u002Fdata-structures\u002Favl-trees",[97],"Balanced Trees","An AVL tree is the first balanced BST: at every node the two subtrees' heights differ by at most $1$. A Fibonacci-style minimal-node argument forces height $h \\le 1.44\\log_2 n = O(\\log n)$, so search, insert, and delete are all $O(\\log n)$. Insertion rebalances with at most one of four rotation cases (LL, RR, LR, RL); deletion may rotate all the way to the root.",{"title":100,"path":101,"lessonNumber":102,"topics":103,"summary":104},"Balanced Search Trees","\u002Falgorithms\u002Fdata-structures\u002Fbalanced-trees",5,[97],"An ordinary BST can degrade to height $\\Theta(n)$; balanced search trees guarantee $h = O(\\log n)$ by maintaining invariants and repairing them after every update. We meet rotations, the local restructuring primitive, then red-black trees, whose color invariants force logarithmic height, and finally B-trees, which trade tall-and-thin for short-and-wide to win on disk.",{"title":106,"path":107,"lessonNumber":108,"topics":109,"summary":112},"Disjoint Sets (Union-Find)","\u002Falgorithms\u002Fdata-structures\u002Funion-find",6,[110,111],"Disjoint Sets","Amortized Analysis","The disjoint-set data structure tracks a partition of elements into groups, answering \"are these two in the same group?\" and merging groups on demand. A forest of parent pointers, sped up by union by rank and path compression, drives every operation to near-constant $O(\\alpha(n))$ amortized time — the engine behind connectivity queries and Kruskal's minimum spanning tree.",{"title":114,"path":115,"lessonNumber":116,"topics":117,"summary":119},"Fenwick & Segment Trees","\u002Falgorithms\u002Fdata-structures\u002Ffenwick-and-segment-trees",7,[118],"Range Queries","A prefix-sum array answers a range sum in $O(1)$ but pays $O(n)$ per update; a plain array updates in $O(1)$ but pays $O(n)$ per range sum. Fenwick and segment trees give us _both_ in $O(\\log n)$. The Fenwick (binary indexed) tree is a tiny array keyed by the low bit; the segment tree is a general balanced tree over canonical ranges that handles any associative aggregate and, with lazy propagation, range updates too.",{"module":121,"moduleNumber":102,"slug":122,"lessons":123},"Sequences & Strings","sequences",[124,130,135,141,147],{"title":125,"path":126,"lessonNumber":6,"topics":127,"summary":129},"Two Pointers, Sliding Windows & Prefix Sums","\u002Falgorithms\u002Fsequences\u002Ftwo-pointers-and-windows",[128],"Array Techniques","A family of array idioms that collapse an obvious $O(n^2)$ scan into a single $O(n)$ pass by maintaining an invariant as indices move. We meet two pointers (converging on a sorted array, and a fast\u002Fslow pair for in-place rewriting), the sliding window (fixed and variable size, amortized $O(n)$), and prefix sums, which answer any range-sum in $O(1)$ and count subarrays summing to $k$.",{"title":131,"path":132,"lessonNumber":18,"topics":133,"summary":134},"Monotonic Stacks & Queues","\u002Falgorithms\u002Fsequences\u002Fmonotonic-stacks",[128],"A **monotonic stack** keeps its contents sorted by popping every element that would break the order before each push — turning a family of \"previous\u002Fnext greater (or smaller) element\" questions into a single $O(n)$ scan. We derive the next-greater-element routine and its amortized analysis, fuse two such scans to measure the **largest rectangle in a histogram** in linear time, and extend the idea to a **monotonic deque** that streams the **sliding-window maximum** in $O(n)$.",{"title":136,"path":137,"lessonNumber":24,"topics":138,"summary":140},"Binary Search on the Answer","\u002Falgorithms\u002Fsequences\u002Fbinary-search-on-the-answer",[139],"Searching","Binary search is not really about arrays — it is about locating the boundary of a **monotone predicate** $p(x)$ in $O(\\log(\\text{range}))$ probes. We first pin down the half-open `while (lo \u003C hi)` template for $\\textsc{lower\\_bound}$ and $\\textsc{upper\\_bound}$, then generalize to \"binary search on the answer\": whenever feasibility is monotone in a numeric parameter, we binary search the parameter itself, calling a feasibility check at each step.",{"title":142,"path":143,"lessonNumber":73,"topics":144,"summary":146},"String Matching: Rabin–Karp, KMP & Z","\u002Falgorithms\u002Fsequences\u002Fstring-matching",[145],"Strings","Given a text $T$ of length $n$ and a pattern $P$ of length $m$, find every occurrence of $P$ in $T$. The naive scan costs $O(nm)$; we beat it three ways. Rabin–Karp uses a **rolling hash** to test alignments in $O(1)$ amortised each, with expected $O(n+m)$. KMP precomputes a **failure function** so the scan never re-reads a text character, for worst-case $O(n+m)$. The **Z-function** gives the same bound from a different angle and converts freely to KMP's table.",{"title":148,"path":149,"lessonNumber":102,"topics":150,"summary":151},"Tries & Prefix Trees","\u002Falgorithms\u002Fsequences\u002Ftries",[145],"A **trie** stores a set of strings in a tree keyed by _characters_, so that insert, search, and prefix-test all run in $O(L)$ time — the length of the key, _independent of how many keys are stored_. Shared prefixes are stored once, which makes tries the natural structure for autocomplete, wildcard dictionaries, board word-search, and — over the alphabet $\\{0,1\\}$ — the maximum-XOR-pair problem.",{"module":153,"moduleNumber":108,"slug":154,"lessons":155},"Graphs","graphs",[156,163,168,173,178,183,188,193,199],{"title":157,"path":158,"lessonNumber":6,"topics":159,"summary":162},"Graph Representations and Traversal","\u002Falgorithms\u002Fgraphs\u002Frepresentations-and-traversal",[160,161],"Graph Representations","Graph Traversal","A graph captures _relationships_ — who connects to whom. We fix the vocabulary, weigh the two standard representations (adjacency list versus matrix), then meet the two explorations you'll use constantly: breadth-first search, which finds shortest paths by number of edges, and depth-first search, whose discovery and finish times reveal a graph's hidden structure. Both run in $O(V + E)$.",{"title":164,"path":165,"lessonNumber":18,"topics":166,"summary":167},"Topological Sort and Strong Connectivity","\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc",[161],"Directed acyclic graphs model dependencies: tasks that must precede other tasks. A _topological order_ lays such a graph out in a line so every edge points forward, and depth-first finish times hand it to us almost for free. We then ask the harder question for graphs _with_ cycles: which vertices can reach each other? The answer is the strongly connected components, found by a two-pass DFS.",{"title":169,"path":170,"lessonNumber":24,"topics":171,"summary":172},"Minimum Spanning Trees","\u002Falgorithms\u002Fgraphs\u002Fminimum-spanning-trees",[169],"Given a weighted network, how do we connect everything as cheaply as possible? The answer is a minimum spanning tree. One lemma, the cut property, justifies _every_ correct MST algorithm, and from it two famous greedy methods fall out: Kruskal's, which grows a forest edge by edge with a union-find structure, and Prim's, which grows a single tree using a priority queue.",{"title":174,"path":175,"lessonNumber":73,"topics":176,"summary":177},"Shortest Paths","\u002Falgorithms\u002Fgraphs\u002Fshortest-paths",[174],"Finding the cheapest route through a weighted network is one of the most-used algorithms in computing. A single operation — _relaxation_ — underlies them all. Dijkstra's algorithm solves the non-negative case greedily; Bellman-Ford handles negative edges and detects negative cycles; and Floyd-Warshall finds the shortest path between _every_ pair of vertices.",{"title":179,"path":180,"lessonNumber":102,"topics":181,"summary":182},"Network Flow","\u002Falgorithms\u002Fgraphs\u002Fnetwork-flow",[179],"How much can flow through a network from source to sink? Max-flow is a surprisingly general model — once you see a problem as flow, a whole toolbox opens up. We build flow networks, find maximum flows by repeatedly pushing along augmenting paths in the residual graph, prove the max-flow min-cut theorem, and watch bipartite matching fall out as a special case.",{"title":184,"path":185,"lessonNumber":108,"topics":186,"summary":187},"Bridges & Articulation Points","\u002Falgorithms\u002Fgraphs\u002Fbridges-and-articulation-points",[153],"A **bridge** is an edge whose removal disconnects the graph; an **articulation point** is a vertex whose removal does. Both are single points of failure in a network. A single depth-first search computes discovery times and **low-links**, and two local criteria — $low[v] > disc[u]$ for bridges, $low[v] \\ge disc[u]$ for cut vertices — find them all in $O(V+E)$.",{"title":189,"path":190,"lessonNumber":116,"topics":191,"summary":192},"Lowest Common Ancestor & Binary Lifting","\u002Falgorithms\u002Fgraphs\u002Flowest-common-ancestor",[153],"Given a rooted tree, the lowest common ancestor of $u$ and $v$ is the deepest node that is an ancestor of both. A naive walk answers one query in $O(h)$; **binary lifting** precomputes the $2^k$-th ancestor of every node in $O(n\\log n)$, then answers $k$-th-ancestor and LCA queries in $O(\\log n)$ each. We derive both jumps, apply them to tree distance, and compare against the Euler-tour + RMQ and Tarjan offline alternatives.",{"title":194,"path":195,"lessonNumber":196,"topics":197,"summary":198},"2-SAT via Implication Graphs","\u002Falgorithms\u002Fgraphs\u002Ftwo-sat",8,[153],"A boolean formula whose every clause has exactly two literals can be solved in _linear_ time — even though its three-literal cousin is NP-complete. The trick is to read each clause as a pair of implications, build a directed graph on the $2n$ literals, and ask a question we already know how to answer: which literals share a strongly connected component? The formula is satisfiable iff no variable lands in the same SCC as its own negation, and the SCCs' topological order hands us a satisfying assignment for free.",{"title":200,"path":201,"lessonNumber":202,"topics":203,"summary":204},"Eulerian Tours","\u002Falgorithms\u002Fgraphs\u002Feulerian-tours",9,[153],"An **Eulerian tour** uses every _edge_ of a graph exactly once. We give the exact parity and balance conditions under which one exists (even degree for undirected graphs, in-degree equal to out-degree for directed) and Hierholzer's $O(E)$ algorithm that constructs one by splicing closed sub-tours. We contrast this sharply with the **Hamiltonian** problem (visit every _vertex_ once), which is NP-complete: visiting edges is easy, visiting vertices is hard.",{"module":206,"moduleNumber":116,"slug":207,"lessons":208},"Greedy Algorithms","greedy",[209,214,220,225],{"title":210,"path":211,"lessonNumber":6,"topics":212,"summary":213},"The Greedy Method","\u002Falgorithms\u002Fgreedy\u002Fthe-greedy-method",[206],"A greedy algorithm builds a solution one locally-best choice at a time and never looks back. We pin down the two properties that make this work — the greedy-choice property and optimal substructure — prove the canonical activity-selection algorithm correct with an exchange argument, watch greedy fail spectacularly on the 0\u002F1 knapsack, and glimpse matroids as the theory that says exactly when greed is good.",{"title":215,"path":216,"lessonNumber":18,"topics":217,"summary":219},"Scheduling & Interval Partitioning","\u002Falgorithms\u002Fgreedy\u002Fscheduling-and-intervals",[218],"Greedy","Three classic scheduling problems all yield to greedy algorithms — and all three turn on a single design decision: which key to sort by. Interval scheduling sorts by **finish** time to pack the most compatible jobs; interval partitioning sorts by **start** time and proves the rooms needed equal the maximum overlap **depth**; minimizing maximum lateness sorts by **deadline** and is justified by an adjacent-swap exchange argument.",{"title":221,"path":222,"lessonNumber":24,"topics":223,"summary":224},"Huffman Codes","\u002Falgorithms\u002Fgreedy\u002Fhuffman-codes",[206],"Huffman coding is the greedy method's most beautiful application: it builds a provably optimal prefix-free binary code by repeatedly merging the two least frequent symbols. We develop prefix-free codes as binary trees, give the algorithm with a priority queue, build a Huffman tree from example frequencies, prove optimality with the same greedy-choice-plus-substructure argument, and pin the running time at $O(n\\log n)$.",{"title":226,"path":227,"lessonNumber":73,"topics":228,"summary":229},"Matroids & Exchange Arguments","\u002Falgorithms\u002Fgreedy\u002Fmatroids",[218],"The capstone of the greedy module: _why_ and _when_ a greedy algorithm is provably optimal. We recap the two correctness templates — **greedy-stays-ahead** and the **exchange argument** — then meet the **matroid** $M=(S,\\mathcal{I})$, an abstraction whose **exchange property** is exactly the structure greedy needs. The matroid–greedy theorem says sorting by weight and taking what stays independent yields a maximum-weight basis _if and only if_ the structure is a matroid. Kruskal's MST is the canonical instance; 0\u002F1 knapsack and TSP are the canonical failures.",{"module":231,"moduleNumber":196,"slug":232,"lessons":233},"Dynamic Programming","dynamic-programming",[234,239,245,250,255,260,265,270,275,280],{"title":235,"path":236,"lessonNumber":6,"topics":237,"summary":238},"Principles of Dynamic Programming","\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples",[231,26],"Dynamic programming is recursion with memory: when a recursive solution re-solves the same subproblems again and again, we solve each one once and store the answer. We pin down the two structural conditions that make this work — overlapping subproblems and optimal substructure — contrast top-down memoization with bottom-up tabulation, and distil the whole method into a five-step recipe.",{"title":240,"path":241,"lessonNumber":18,"topics":242,"summary":244},"Sequence Alignment & LCS","\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp",[231,243],"String Structures","Two strings can be compared by asking how much of one survives inside the other. The longest common subsequence (LCS) and edit distance are the two classic answers, and they are the _same_ dynamic program wearing different costs. We derive the LCS recurrence by examining the last characters, fill a worked DP table, reconstruct the subsequence, and then show edit distance as the identical $\\Theta(mn)$ pattern.",{"title":246,"path":247,"lessonNumber":24,"topics":248,"summary":249},"Longest Increasing Subsequence","\u002Falgorithms\u002Fdynamic-programming\u002Flongest-increasing-subsequence",[231],"Given a sequence of numbers, how long is its longest strictly increasing subsequence? A first dynamic program indexes subproblems by the element each subsequence _ends at_, giving an $O(n^2)$ solution with parent-pointer reconstruction. A sharper idea, the patience-sorting _tails_ array searched by binary search, drops the time to $O(n\\log n)$. We then fold in the variants: non-decreasing, counting, Russian-doll envelopes, and bitonic.",{"title":251,"path":252,"lessonNumber":73,"topics":253,"summary":254},"Knapsack & Subset Problems","\u002Falgorithms\u002Fdynamic-programming\u002Fknapsack",[231],"We start from $\\textsc{Subset-sum}$ — does some sublist hit a target $t$? — and its include\u002Fexclude recurrence over a boolean table $A(i, u)$, then bolt on values to get 0\u002F1 knapsack as the same machine with $\\lor$ promoted to $\\max$. We fill both tables, recover the chosen items, and confront the surprise that the $\\Theta(nt)$ running time is only _pseudo-polynomial_ — exponential in the bit length $b$, and unimprovable unless $\\mathrm{P}=\\mathrm{NP}$ since subset-sum is $\\textsc{NP-complete}$. The fractional variant reveals the sharp line between greedy and dynamic programming.",{"title":256,"path":257,"lessonNumber":102,"topics":258,"summary":259},"Coin Change & Unbounded Knapsack","\u002Falgorithms\u002Fdynamic-programming\u002Fcoin-change-and-unbounded",[231],"The previous lesson let each item be taken at most once. Drop that cap — items may be reused _any number of times_ — and the 0\u002F1 knapsack collapses from a two-dimensional table to a one-dimensional one, because there is no longer a prefix of \"already-used\" items to track. We meet **unbounded knapsack**, then its most famous instance, **coin change**: the minimum-coins recurrence $C[a] = 1 + \\min_c C[a-c]$, and the counting variant where the _order of the loops_ decides whether you count unordered combinations or ordered sequences — the classic bug. Greed fails in general but works for canonical coin systems.",{"title":261,"path":262,"lessonNumber":108,"topics":263,"summary":264},"Interval DP","\u002Falgorithms\u002Fdynamic-programming\u002Finterval-dp",[231],"Many problems ask for the best way to combine a contiguous range of items, and the answer is a dynamic program over subintervals $[i,j]$ that chooses a split point $k$. We derive the pattern from matrix-chain multiplication — parenthesising a product to minimize scalar multiplications in $O(n^3)$ — distil it into a reusable template filled by increasing interval length, and then meet its sharpest variant: the \"last operation\" trick behind Burst Balloons and cutting a stick, where fixing the _last_ move (not the first) makes the two sides independent.",{"title":266,"path":267,"lessonNumber":116,"topics":268,"summary":269},"Dynamic Programming on Trees","\u002Falgorithms\u002Fdynamic-programming\u002Ftree-dp",[231],"When the subproblems of a dynamic program are _rooted subtrees_, a single post-order DFS solves the whole thing in $O(n)$: each node combines the already-computed answers of its children. We meet the archetype — maximum-weight independent set on a tree — then the \"path through a node\" pattern behind tree diameter and maximum path sum, and finally **rerooting**, which computes a per-node answer for _every_ node as root in $O(n)$ with two passes.",{"title":271,"path":272,"lessonNumber":196,"topics":273,"summary":274},"Bitmask DP","\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp",[231],"When a subproblem depends not on an index or a prefix but on _which subset_ of a small ground set has been used, we can encode that subset as the bits of an integer and index a DP table by it. With $n \\le \\sim 20$ the $2^n$ subsets fit in a table, turning $\\Theta(n!)$ brute force into $O(2^n \\cdot \\text{poly}(n))$. We meet the bit tricks, the Held–Karp TSP archetype, assignment by mask, subset-sum partitioning, and submask enumeration with its $3^n$ bound.",{"title":276,"path":277,"lessonNumber":202,"topics":278,"summary":279},"DP Optimizations","\u002Falgorithms\u002Fdynamic-programming\u002Fdp-optimizations",[231],"A correct DP recurrence is only half the battle; its naive evaluation is often a factor of $n$ slower than necessary. This capstone surveys five techniques, monotonic-queue, the convex hull trick, divide-and-conquer optimization, Knuth's optimization, and SOS DP, that each exploit _structure in the transition_ (a sliding window, linear costs, monotone optimal splits, the quadrangle inequality, or subset lattices) to shave an $O(n)$, $O(\\log n)$, or worse factor off the running time.",{"title":281,"path":282,"lessonNumber":283,"topics":284,"summary":285},"Dynamic Programming on Graphs","\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs",10,[231],"Many graph algorithms are dynamic programs in disguise: the subproblem is the _best value reachable under a restricted resource_ — intermediate vertices allowed, edges allowed, or a topological prefix — and edge _relaxation_ is the DP transition. We frame Floyd–Warshall as the archetype ($O(V^3)$ all-pairs shortest paths), Bellman–Ford as a DP over path length (the at-most-$K$-stops variant), DAG-DP in topological order ($O(V+E)$), and Warshall's transitive closure as the boolean analog.",{"module":287,"moduleNumber":202,"slug":288,"lessons":289},"Backtracking & Search","backtracking",[290,296,301],{"title":291,"path":292,"lessonNumber":6,"topics":293,"summary":295},"Backtracking: Subsets, Permutations & Combinations","\u002Falgorithms\u002Fbacktracking\u002Fbacktracking-fundamentals",[294],"Backtracking","Backtracking builds a solution one choice at a time and abandons a partial solution the moment it cannot be completed, exploring a state-space tree by depth-first search. We meet the universal choose\u002Fexplore\u002Fun-choose template, derive the canonical enumerations — subsets ($2^n$), permutations ($n!$), and combinations ($\\binom{n}{k}$) — handle duplicate elements by skipping equal siblings, and see how pruning turns an exponential search into a tractable one.",{"title":297,"path":298,"lessonNumber":18,"topics":299,"summary":300},"Constraint Search: N-Queens & Sudoku","\u002Falgorithms\u002Fbacktracking\u002Fconstraint-search",[294],"Many hard puzzles are **constraint satisfaction problems**: assign each variable a value from its domain so that every constraint holds. Backtracking solves them by assigning variables one at a time and rejecting a partial assignment the instant a constraint breaks. We make the rejection cheap — $O(1)$ conflict checks for N-Queens via column and diagonal sets — and prune harder with **forward checking**, **MRV** ordering, and **constraint propagation**, which is what lets an exponential search actually finish.",{"title":302,"path":303,"lessonNumber":24,"topics":304,"summary":305},"Branch & Bound and Meet in the Middle","\u002Falgorithms\u002Fbacktracking\u002Fbranch-and-bound",[294],"Plain backtracking prunes a search tree by _feasibility_; for _optimization_ problems we can prune far more aggressively by _value_. **Branch and bound** keeps the best complete solution found so far and discards any partial solution whose optimistic bound cannot beat it. **Meet in the middle** splits the instance in two, enumerates each half, and recombines by binary search — turning $2^n$ into $O(2^{n\u002F2}\\,n)$ and pushing exact search out to $n \\approx 40$.",{"module":307,"moduleNumber":283,"slug":308,"lessons":309},"Mathematical Algorithms","mathematical-algorithms",[310,316,321,326],{"title":311,"path":312,"lessonNumber":6,"topics":313,"summary":315},"Number Theory: GCD & Modular Arithmetic","\u002Falgorithms\u002Fmathematical-algorithms\u002Fnumber-theory-basics",[314],"Number Theory","This lesson opens the mathematical-algorithms module with the bedrock of computational number theory. We prove Euclid's recurrence $\\gcd(a,b)=\\gcd(b,\\,a\\bmod b)$ and its $O(\\log\\min(a,b))$ running time, extend it to recover Bézout coefficients $x,y$ with $ax+by=\\gcd(a,b)$, and build modular arithmetic on residue classes — including when a modular inverse $a^{-1}\\bmod m$ exists and how to compute it.",{"title":317,"path":318,"lessonNumber":18,"topics":319,"summary":320},"Modular Exponentiation & Primality","\u002Falgorithms\u002Fmathematical-algorithms\u002Fmodular-exponentiation-and-primality",[314],"Computing $a^n \\bmod m$ naively costs $n$ multiplications; **repeated squaring** does it in $O(\\log n)$ by reading the bits of the exponent. We use this routine to state **Fermat's little theorem** (and the modular inverse it gives), then to test primality — trial division, the probabilistic **Fermat** and **Miller–Rabin** tests, and the deterministic witness set that settles primality for every 64-bit number.",{"title":322,"path":323,"lessonNumber":24,"topics":324,"summary":325},"Sieves & Factorization","\u002Falgorithms\u002Fmathematical-algorithms\u002Fsieve-and-factorization",[314],"The previous lesson tested one number for primality; here we ask for _all_ primes up to $n$ at once. The **sieve of Eratosthenes** cross-cuts composites in $O(n\\log\\log n)$, and a **linear sieve** does it in $O(n)$ while recording each number's **smallest prime factor**, which then factors any $x \\le n$ in $O(\\log x)$. From a factorization $x = \\prod p_i^{e_i}$ the multiplicative functions $\\tau$, $\\sigma$, and Euler's totient $\\varphi$ fall out immediately.",{"title":327,"path":328,"lessonNumber":73,"topics":329,"summary":330},"Combinatorics & Counting","\u002Falgorithms\u002Fmathematical-algorithms\u002Fcombinatorics",[314],"Counting is the arithmetic of finite sets. We build up from permutations $n!$ and combinations $\\binom{n}{k}$, prove Pascal's rule by a bijection, and count multisets with stars and bars. The practical core is computing $\\binom{n}{k}\\bmod p$ in $O(1)$ from precomputed factorials and inverse factorials. We close with inclusion–exclusion and the Chinese Remainder Theorem, both of which lean on the modular inverse from the previous lesson.",{"module":332,"moduleNumber":333,"slug":334,"lessons":335},"Computational Geometry",11,"computational-geometry",[336,342,347],{"title":337,"path":338,"lessonNumber":6,"topics":339,"summary":341},"Geometric Primitives & Orientation","\u002Falgorithms\u002Fcomputational-geometry\u002Fgeometric-primitives",[340],"Geometry","Computational geometry is built on a single reliable primitive — the **orientation test**, a sign of a cross product that tells whether three points turn left, right, or lie collinear. From points-as-vectors and the dot and cross products we derive orientation, segment intersection, the shoelace area formula, and point-in-polygon tests, keeping all arithmetic **exact and integer** so that no floating-point rounding can corrupt a sign.",{"title":343,"path":344,"lessonNumber":18,"topics":345,"summary":346},"Convex Hull","\u002Falgorithms\u002Fcomputational-geometry\u002Fconvex-hull",[340],"The convex hull is the smallest convex polygon enclosing a point set — the rubber band snapped around the nails. We build it with Andrew's monotone chain, sorting by $(x,y)$ and sweeping a lower and upper hull while popping any non-left turn via the orientation primitive, in $O(n\\log n)$. A reduction from sorting shows that bound is optimal, and the hull unlocks diameter, smallest enclosing rectangle, and more through rotating calipers.",{"title":348,"path":349,"lessonNumber":24,"topics":350,"summary":351},"Sweep-Line Algorithms","\u002Falgorithms\u002Fcomputational-geometry\u002Fsweep-line",[340],"The plane-sweep paradigm turns a static $2$-D geometry problem into a dynamic $1$-D ordered-set problem: a vertical line sweeps left to right, stopping at an $x$-sorted **event queue** while a balanced-BST **status structure** tracks the objects it currently crosses, ordered by $y$. We derive Bentley–Ottmann segment intersection in $O((n+k)\\log n)$, recover closest-pair in $O(n\\log n)$, and reduce skyline, rectangle-area, and overlap problems to $\\pm1$ event sweeps.",{"module":353,"moduleNumber":354,"slug":355,"lessons":356},"Intractability",12,"intractability",[357,363,367],{"title":358,"path":359,"lessonNumber":6,"topics":360,"summary":362},"P, NP, and Reductions","\u002Falgorithms\u002Fintractability\u002Fp-np-reductions",[361],"NP-Completeness","Most problems we have met so far have fast algorithms. A vast and important family seemingly does not. This lesson builds the vocabulary for that divide: decision problems, the class $\\mathsf{P}$ of problems we can solve quickly, the class $\\mathsf{NP}$ of problems whose solutions we can _check_ quickly, and polynomial-time reductions, the tool that lets us compare the difficulty of two problems without solving either.",{"title":361,"path":364,"lessonNumber":18,"topics":365,"summary":366},"\u002Falgorithms\u002Fintractability\u002Fnp-completeness",[361],"Some problems in $\\mathsf{NP}$ are universally hardest: every other problem in $\\mathsf{NP}$ reduces to them. This lesson defines $\\mathsf{NP}$-hard and $\\mathsf{NP}$-complete, states the Cook–Levin theorem that anchors the whole edifice on **SAT**, walks the web of reductions that grows from it, and gives the four-step recipe for proving a brand-new problem $\\mathsf{NP}$-complete.",{"title":368,"path":369,"lessonNumber":24,"topics":370,"summary":373},"Coping with NP-Hardness","\u002Falgorithms\u002Fintractability\u002Fcoping-with-hardness",[371,372],"Approximation","Heuristics","Proving a problem $\\mathsf{NP}$-hard is the beginning, not the end. The world still needs answers. This lesson surveys the four honest responses to hardness: approximation algorithms with a provable ratio (worked through a 2-approximation for vertex cover), heuristics and local search, exact exponential methods like branch and bound, and exploiting special structure in the instances you actually face.",{"id":375,"title":281,"blurb":376,"body":377,"description":9878,"extension":9879,"meta":9880,"module":231,"navigation":9882,"path":282,"practice":9883,"rawbody":9897,"readingTime":9898,"seo":9903,"sources":9904,"status":9911,"stem":9912,"summary":285,"topics":9913,"__hash__":9914},"course\u002F01.algorithms\u002F08.dynamic-programming\u002F10.dp-on-graphs.md","",{"type":378,"value":379,"toc":9868},"minimark",[380,413,425,486,610,615,664,1005,1191,1512,2064,2083,2684,3061,3300,3355,3480,3566,3851,3855,3861,4145,4277,4616,4891,5091,5615,5767,5771,5927,5972,6073,6227,6471,6644,6860,6863,7282,7286,7503,7850,8013,8017,8393,8397,8400,8818,8822,9623,9864],[381,382,383,384,387,388,392,393,395,396,400,401,408,409,412],"p",{},"The Graphs module's ",[385,386,174],"a",{"href":175}," lesson\nintroduced three algorithms (Dijkstra, Bellman–Ford, Floyd–Warshall) and\nremarked that one operation, ",[389,390,391],"strong",{},"relaxation",", underlies them all. The\n",[385,394,235],{"href":236},"\nlesson then distilled DP into ",[397,398,399],"em",{},"optimal substructure plus overlapping\nsubproblems",". This lesson connects the two ideas with a single thesis: ",[389,402,403,404,407],{},"many\ngraph algorithms ",[397,405,406],{},"are"," dynamic programs",", and relaxation ",[397,410,411],{},"is"," the DP\ntransition.",[381,414,415,416,419,420,424],{},"The pattern is always the same. We define a subproblem as the ",[389,417,418],{},"best value\nobtainable using a restricted resource",", and we grow the resource one unit at a\ntime. The ",[421,422,423],"q",{},"resource"," is whatever we ration:",[426,427,428,436,470,477],"ul",{},[429,430,431,432,435],"li",{},"the set of ",[389,433,434],{},"intermediate vertices"," a path may pass through (Floyd–Warshall);",[429,437,438,439,442,443,469],{},"the number of ",[389,440,441],{},"edges"," a path may use (Bellman–Ford, ",[444,445,448],"span",{"className":446},[447],"katex",[444,449,453],{"className":450,"ariaHidden":452},[451],"katex-html","true",[444,454,457,462],{"className":455},[456],"base",[444,458],{"className":459,"style":461},[460],"strut","height:0.6833em;",[444,463,468],{"className":464,"style":467},[465,466],"mord","mathnormal","margin-right:0.0715em;","K","-stops);",[429,471,472,473,476],{},"a ",[389,474,475],{},"topological prefix"," of an acyclic graph (DAG-DP);",[429,478,472,479,482,483,485],{},[389,480,481],{},"subset"," of vertices already visited (Held–Karp, the\n",[385,484,271],{"href":272}," lesson).",[381,487,488,489,531,532,548,549,564,565,587,588,591,592,595,596,599,600],{},"Relaxing an edge ",[444,490,492],{"className":491},[447],[444,493,495],{"className":494,"ariaHidden":452},[451],[444,496,498,502,507,511,516,521,526],{"className":497},[456],[444,499],{"className":500,"style":501},[460],"height:1em;vertical-align:-0.25em;",[444,503,506],{"className":504},[505],"mopen","(",[444,508,510],{"className":509},[465,466],"u",[444,512,515],{"className":513},[514],"mpunct",",",[444,517],{"className":518,"style":520},[519],"mspace","margin-right:0.1667em;",[444,522,525],{"className":523,"style":524},[465,466],"margin-right:0.0359em;","v",[444,527,530],{"className":528},[529],"mclose",")",", testing whether routing through ",[444,533,535],{"className":534},[447],[444,536,538],{"className":537,"ariaHidden":452},[451],[444,539,541,545],{"className":540},[456],[444,542],{"className":543,"style":544},[460],"height:0.4306em;",[444,546,510],{"className":547},[465,466]," improves the\ncurrent estimate for ",[444,550,552],{"className":551},[447],[444,553,555],{"className":554,"ariaHidden":452},[451],[444,556,558,561],{"className":557},[456],[444,559],{"className":560,"style":544},[460],[444,562,525],{"className":563,"style":524},[465,466],", is exactly the ",[444,566,568],{"className":567},[447],[444,569,571],{"className":570,"ariaHidden":452},[451],[444,572,574,578],{"className":573},[456],[444,575],{"className":576,"style":577},[460],"height:0.6679em;",[444,579,582],{"className":580},[581],"mop",[444,583,586],{"className":584},[465,585],"mathrm","min"," over choices in a DP recurrence.\nOnce you see this, ",[421,589,590],{},"is there a path?",", ",[421,593,594],{},"what is the cheapest path?",", and ",[421,597,598],{},"how many shortest paths are there?"," all become the same exercise: pick the resource,\nwrite the recurrence, choose an evaluation order that respects the\ndependencies.",[601,602,603],"sup",{},[385,604,609],{"href":605,"ariaDescribedBy":606,"dataFootnoteRef":376,"id":608},"#user-content-fn-erickson-dp",[607],"footnote-label","user-content-fnref-erickson-dp","1",[611,612,614],"h2",{"id":613},"floydwarshall-intermediate-vertices-as-the-resource","Floyd–Warshall: intermediate vertices as the resource",[381,616,617,618,659,660,663],{},"Number the vertices ",[444,619,621],{"className":620},[447],[444,622,624],{"className":623,"ariaHidden":452},[451],[444,625,627,631,634,637,640,645,648,651,654],{"className":626},[456],[444,628],{"className":629,"style":630},[460],"height:0.8778em;vertical-align:-0.1944em;",[444,632,609],{"className":633},[465],[444,635,515],{"className":636},[514],[444,638],{"className":639,"style":520},[519],[444,641,644],{"className":642},[643],"minner","…",[444,646],{"className":647,"style":520},[519],[444,649,515],{"className":650},[514],[444,652],{"className":653,"style":520},[519],[444,655,658],{"className":656,"style":657},[465,466],"margin-right:0.2222em;","V",". Restrict ",[397,661,662],{},"which vertices a\npath is allowed to pass through internally",", and relax that restriction one\nvertex at a time.",[665,666,668],"callout",{"type":667},"definition",[381,669,670,673,674,768,769,785,786,802,803,806,807,851,852,876,877,948,949,1004],{},[389,671,672],{},"Definition."," Let ",[444,675,677],{"className":676},[447],[444,678,680],{"className":679,"ariaHidden":452},[451],[444,681,683,686,745,749,753,757,760,765],{"className":682},[456],[444,684],{"className":685,"style":501},[460],[444,687,689,693],{"className":688},[465],[444,690,692],{"className":691},[465,466],"d",[444,694,697],{"className":695},[696],"msupsub",[444,698,702,736],{"className":699},[700,701],"vlist-t","vlist-t2",[444,703,706,731],{"className":704},[705],"vlist-r",[444,707,711],{"className":708,"style":710},[709],"vlist","height:0.3361em;",[444,712,714,719],{"style":713},"top:-2.55em;margin-left:0em;margin-right:0.05em;",[444,715],{"className":716,"style":718},[717],"pstrut","height:2.7em;",[444,720,726],{"className":721},[722,723,724,725],"sizing","reset-size6","size3","mtight",[444,727,730],{"className":728,"style":729},[465,466,725],"margin-right:0.0315em;","k",[444,732,735],{"className":733},[734],"vlist-s","​",[444,737,739],{"className":738},[705],[444,740,743],{"className":741,"style":742},[709],"height:0.15em;",[444,744],{},[444,746,748],{"className":747},[505],"[",[444,750,752],{"className":751},[465,466],"i",[444,754,756],{"className":755},[529],"]",[444,758,748],{"className":759},[505],[444,761,764],{"className":762,"style":763},[465,466],"margin-right:0.0572em;","j",[444,766,756],{"className":767},[529]," be the weight of a shortest path from ",[444,770,772],{"className":771},[447],[444,773,775],{"className":774,"ariaHidden":452},[451],[444,776,778,782],{"className":777},[456],[444,779],{"className":780,"style":781},[460],"height:0.6595em;",[444,783,752],{"className":784},[465,466]," to\n",[444,787,789],{"className":788},[447],[444,790,792],{"className":791,"ariaHidden":452},[451],[444,793,795,799],{"className":794},[456],[444,796],{"className":797,"style":798},[460],"height:0.854em;vertical-align:-0.1944em;",[444,800,764],{"className":801,"style":763},[465,466]," all of whose ",[389,804,805],{},"intermediate"," vertices lie in ",[444,808,810],{"className":809},[447],[444,811,813],{"className":812,"ariaHidden":452},[451],[444,814,816,819,823,826,829,832,835,838,841,844,847],{"className":815},[456],[444,817],{"className":818,"style":501},[460],[444,820,822],{"className":821},[505],"{",[444,824,609],{"className":825},[465],[444,827,515],{"className":828},[514],[444,830],{"className":831,"style":520},[519],[444,833,644],{"className":834},[643],[444,836],{"className":837,"style":520},[519],[444,839,515],{"className":840},[514],[444,842],{"className":843,"style":520},[519],[444,845,730],{"className":846,"style":729},[465,466],[444,848,850],{"className":849},[529],"}"," (the\nendpoints ",[444,853,855],{"className":854},[447],[444,856,858],{"className":857,"ariaHidden":452},[451],[444,859,861,864,867,870,873],{"className":860},[456],[444,862],{"className":863,"style":798},[460],[444,865,752],{"className":866},[465,466],[444,868,515],{"className":869},[514],[444,871],{"className":872,"style":520},[519],[444,874,764],{"className":875,"style":763},[465,466]," are unrestricted). Then ",[444,878,880],{"className":879},[447],[444,881,883],{"className":882,"ariaHidden":452},[451],[444,884,886,889,930,933,936,939,942,945],{"className":885},[456],[444,887],{"className":888,"style":501},[460],[444,890,892,895],{"className":891},[465],[444,893,692],{"className":894},[465,466],[444,896,898],{"className":897},[696],[444,899,901,922],{"className":900},[700,701],[444,902,904,919],{"className":903},[705],[444,905,908],{"className":906,"style":907},[709],"height:0.3283em;",[444,909,910,913],{"style":713},[444,911],{"className":912,"style":718},[717],[444,914,916],{"className":915},[722,723,724,725],[444,917,658],{"className":918,"style":657},[465,466,725],[444,920,735],{"className":921},[734],[444,923,925],{"className":924},[705],[444,926,928],{"className":927,"style":742},[709],[444,929],{},[444,931,748],{"className":932},[505],[444,934,752],{"className":935},[465,466],[444,937,756],{"className":938},[529],[444,940,748],{"className":941},[505],[444,943,764],{"className":944,"style":763},[465,466],[444,946,756],{"className":947},[529]," is the true all-pairs\nshortest distance, and ",[444,950,952],{"className":951},[447],[444,953,955],{"className":954,"ariaHidden":452},[451],[444,956,958,962],{"className":957},[456],[444,959],{"className":960,"style":961},[460],"height:0.8444em;vertical-align:-0.15em;",[444,963,965,968],{"className":964},[465],[444,966,692],{"className":967},[465,466],[444,969,971],{"className":970},[696],[444,972,974,996],{"className":973},[700,701],[444,975,977,993],{"className":976},[705],[444,978,981],{"className":979,"style":980},[709],"height:0.3011em;",[444,982,983,986],{"style":713},[444,984],{"className":985,"style":718},[717],[444,987,989],{"className":988},[722,723,724,725],[444,990,992],{"className":991},[465,725],"0",[444,994,735],{"className":995},[734],[444,997,999],{"className":998},[705],[444,1000,1002],{"className":1001,"style":742},[709],[444,1003],{}," is just the weight matrix.",[381,1006,1007,1008,1078,1079,1114,1115,1131,1132,1168,1169,1190],{},"The base case ",[444,1009,1011],{"className":1010},[447],[444,1012,1014],{"className":1013,"ariaHidden":452},[451],[444,1015,1017,1020,1060,1063,1066,1069,1072,1075],{"className":1016},[456],[444,1018],{"className":1019,"style":501},[460],[444,1021,1023,1026],{"className":1022},[465],[444,1024,692],{"className":1025},[465,466],[444,1027,1029],{"className":1028},[696],[444,1030,1032,1052],{"className":1031},[700,701],[444,1033,1035,1049],{"className":1034},[705],[444,1036,1038],{"className":1037,"style":980},[709],[444,1039,1040,1043],{"style":713},[444,1041],{"className":1042,"style":718},[717],[444,1044,1046],{"className":1045},[722,723,724,725],[444,1047,992],{"className":1048},[465,725],[444,1050,735],{"className":1051},[734],[444,1053,1055],{"className":1054},[705],[444,1056,1058],{"className":1057,"style":742},[709],[444,1059],{},[444,1061,748],{"className":1062},[505],[444,1064,752],{"className":1065},[465,466],[444,1067,756],{"className":1068},[529],[444,1070,748],{"className":1071},[505],[444,1073,764],{"className":1074,"style":763},[465,466],[444,1076,756],{"className":1077},[529]," is ",[444,1080,1082],{"className":1081},[447],[444,1083,1085],{"className":1084,"ariaHidden":452},[451],[444,1086,1088,1091,1096,1099,1102,1105,1108,1111],{"className":1087},[456],[444,1089],{"className":1090,"style":501},[460],[444,1092,1095],{"className":1093,"style":1094},[465,466],"margin-right:0.0269em;","w",[444,1097,506],{"className":1098},[505],[444,1100,752],{"className":1101},[465,466],[444,1103,515],{"className":1104},[514],[444,1106],{"className":1107,"style":520},[519],[444,1109,764],{"className":1110,"style":763},[465,466],[444,1112,530],{"className":1113},[529]," if the edge exists, ",[444,1116,1118],{"className":1117},[447],[444,1119,1121],{"className":1120,"ariaHidden":452},[451],[444,1122,1124,1128],{"className":1123},[456],[444,1125],{"className":1126,"style":1127},[460],"height:0.6444em;",[444,1129,992],{"className":1130},[465]," if ",[444,1133,1135],{"className":1134},[447],[444,1136,1138,1159],{"className":1137,"ariaHidden":452},[451],[444,1139,1141,1144,1147,1151,1156],{"className":1140},[456],[444,1142],{"className":1143,"style":781},[460],[444,1145,752],{"className":1146},[465,466],[444,1148],{"className":1149,"style":1150},[519],"margin-right:0.2778em;",[444,1152,1155],{"className":1153},[1154],"mrel","=",[444,1157],{"className":1158,"style":1150},[519],[444,1160,1162,1165],{"className":1161},[456],[444,1163],{"className":1164,"style":798},[460],[444,1166,764],{"className":1167,"style":763},[465,466],", and\n",[444,1170,1172],{"className":1171},[447],[444,1173,1175],{"className":1174,"ariaHidden":452},[451],[444,1176,1178,1182,1186],{"className":1177},[456],[444,1179],{"className":1180,"style":1181},[460],"height:0.6667em;vertical-align:-0.0833em;",[444,1183,1185],{"className":1184},[465],"+",[444,1187,1189],{"className":1188},[465],"∞"," otherwise, since no intermediate vertices are allowed, so only direct\nedges count. The induction is the core of the method.",[665,1192,1194],{"type":1193},"lemma",[381,1195,1196,1199,1200,1235,1236,1278,1279,1282,1283,1299,1300,1362,1363,1382,1383,1416,1417,1450,1451,1511],{},[389,1197,1198],{},"Lemma (optimal substructure)."," A shortest ",[444,1201,1203],{"className":1202},[447],[444,1204,1206,1226],{"className":1205,"ariaHidden":452},[451],[444,1207,1209,1212,1215,1218,1223],{"className":1208},[456],[444,1210],{"className":1211,"style":781},[460],[444,1213,752],{"className":1214},[465,466],[444,1216],{"className":1217,"style":1150},[519],[444,1219,1222],{"className":1220},[1154,1221],"amsrm","⇝",[444,1224],{"className":1225,"style":1150},[519],[444,1227,1229,1232],{"className":1228},[456],[444,1230],{"className":1231,"style":798},[460],[444,1233,764],{"className":1234,"style":763},[465,466]," path with\nintermediate vertices drawn from ",[444,1237,1239],{"className":1238},[447],[444,1240,1242],{"className":1241,"ariaHidden":452},[451],[444,1243,1245,1248,1251,1254,1257,1260,1263,1266,1269,1272,1275],{"className":1244},[456],[444,1246],{"className":1247,"style":501},[460],[444,1249,822],{"className":1250},[505],[444,1252,609],{"className":1253},[465],[444,1255,515],{"className":1256},[514],[444,1258],{"className":1259,"style":520},[519],[444,1261,644],{"className":1262},[643],[444,1264],{"className":1265,"style":520},[519],[444,1267,515],{"className":1268},[514],[444,1270],{"className":1271,"style":520},[519],[444,1273,730],{"className":1274,"style":729},[465,466],[444,1276,850],{"className":1277},[529]," either ",[389,1280,1281],{},"does not use"," ",[444,1284,1286],{"className":1285},[447],[444,1287,1289],{"className":1288,"ariaHidden":452},[451],[444,1290,1292,1296],{"className":1291},[456],[444,1293],{"className":1294,"style":1295},[460],"height:0.6944em;",[444,1297,730],{"className":1298,"style":729},[465,466],",\nin which case it is a shortest path through ",[444,1301,1303],{"className":1302},[447],[444,1304,1306,1350],{"className":1305,"ariaHidden":452},[451],[444,1307,1309,1312,1315,1318,1321,1324,1327,1330,1333,1336,1339,1342,1347],{"className":1308},[456],[444,1310],{"className":1311,"style":501},[460],[444,1313,822],{"className":1314},[505],[444,1316,609],{"className":1317},[465],[444,1319,515],{"className":1320},[514],[444,1322],{"className":1323,"style":520},[519],[444,1325,644],{"className":1326},[643],[444,1328],{"className":1329,"style":520},[519],[444,1331,515],{"className":1332},[514],[444,1334],{"className":1335,"style":520},[519],[444,1337,730],{"className":1338,"style":729},[465,466],[444,1340],{"className":1341,"style":657},[519],[444,1343,1346],{"className":1344},[1345],"mbin","−",[444,1348],{"className":1349,"style":657},[519],[444,1351,1353,1356,1359],{"className":1352},[456],[444,1354],{"className":1355,"style":501},[460],[444,1357,609],{"className":1358},[465],[444,1360,850],{"className":1361},[529],", or it ",[389,1364,1365,1366,1381],{},"uses\n",[444,1367,1369],{"className":1368},[447],[444,1370,1372],{"className":1371,"ariaHidden":452},[451],[444,1373,1375,1378],{"className":1374},[456],[444,1376],{"className":1377,"style":1295},[460],[444,1379,730],{"className":1380,"style":729},[465,466]," exactly once",", splitting into a shortest ",[444,1384,1386],{"className":1385},[447],[444,1387,1389,1407],{"className":1388,"ariaHidden":452},[451],[444,1390,1392,1395,1398,1401,1404],{"className":1391},[456],[444,1393],{"className":1394,"style":781},[460],[444,1396,752],{"className":1397},[465,466],[444,1399],{"className":1400,"style":1150},[519],[444,1402,1222],{"className":1403},[1154,1221],[444,1405],{"className":1406,"style":1150},[519],[444,1408,1410,1413],{"className":1409},[456],[444,1411],{"className":1412,"style":1295},[460],[444,1414,730],{"className":1415,"style":729},[465,466]," path and a\nshortest ",[444,1418,1420],{"className":1419},[447],[444,1421,1423,1441],{"className":1422,"ariaHidden":452},[451],[444,1424,1426,1429,1432,1435,1438],{"className":1425},[456],[444,1427],{"className":1428,"style":1295},[460],[444,1430,730],{"className":1431,"style":729},[465,466],[444,1433],{"className":1434,"style":1150},[519],[444,1436,1222],{"className":1437},[1154,1221],[444,1439],{"className":1440,"style":1150},[519],[444,1442,1444,1447],{"className":1443},[456],[444,1445],{"className":1446,"style":798},[460],[444,1448,764],{"className":1449,"style":763},[465,466]," path, each through ",[444,1452,1454],{"className":1453},[447],[444,1455,1457,1499],{"className":1456,"ariaHidden":452},[451],[444,1458,1460,1463,1466,1469,1472,1475,1478,1481,1484,1487,1490,1493,1496],{"className":1459},[456],[444,1461],{"className":1462,"style":501},[460],[444,1464,822],{"className":1465},[505],[444,1467,609],{"className":1468},[465],[444,1470,515],{"className":1471},[514],[444,1473],{"className":1474,"style":520},[519],[444,1476,644],{"className":1477},[643],[444,1479],{"className":1480,"style":520},[519],[444,1482,515],{"className":1483},[514],[444,1485],{"className":1486,"style":520},[519],[444,1488,730],{"className":1489,"style":729},[465,466],[444,1491],{"className":1492,"style":657},[519],[444,1494,1346],{"className":1495},[1345],[444,1497],{"className":1498,"style":657},[519],[444,1500,1502,1505,1508],{"className":1501},[456],[444,1503],{"className":1504,"style":501},[460],[444,1506,609],{"className":1507},[465],[444,1509,850],{"className":1510},[529],".",[665,1513,1515],{"type":1514},"proof",[381,1516,1517,1520,1521,1537,1538,1553,1554,1569,1570,1630,1631,1646,1647,1662,1663,1752,1753,1842,1843,1858,1859,1911,1912,1964,1965,2025,2026,2041,2042],{},[389,1518,1519],{},"Proof."," Consider a shortest such path ",[444,1522,1524],{"className":1523},[447],[444,1525,1527],{"className":1526,"ariaHidden":452},[451],[444,1528,1530,1534],{"className":1529},[456],[444,1531],{"className":1532,"style":1533},[460],"height:0.625em;vertical-align:-0.1944em;",[444,1535,381],{"className":1536},[465,466],". If ",[444,1539,1541],{"className":1540},[447],[444,1542,1544],{"className":1543,"ariaHidden":452},[451],[444,1545,1547,1550],{"className":1546},[456],[444,1548],{"className":1549,"style":1295},[460],[444,1551,730],{"className":1552,"style":729},[465,466]," is not an intermediate\nvertex of ",[444,1555,1557],{"className":1556},[447],[444,1558,1560],{"className":1559,"ariaHidden":452},[451],[444,1561,1563,1566],{"className":1562},[456],[444,1564],{"className":1565,"style":1533},[460],[444,1567,381],{"className":1568},[465,466],", all its intermediate vertices already lie in ",[444,1571,1573],{"className":1572},[447],[444,1574,1576,1618],{"className":1575,"ariaHidden":452},[451],[444,1577,1579,1582,1585,1588,1591,1594,1597,1600,1603,1606,1609,1612,1615],{"className":1578},[456],[444,1580],{"className":1581,"style":501},[460],[444,1583,822],{"className":1584},[505],[444,1586,609],{"className":1587},[465],[444,1589,515],{"className":1590},[514],[444,1592],{"className":1593,"style":520},[519],[444,1595,644],{"className":1596},[643],[444,1598],{"className":1599,"style":520},[519],[444,1601,515],{"className":1602},[514],[444,1604],{"className":1605,"style":520},[519],[444,1607,730],{"className":1608,"style":729},[465,466],[444,1610],{"className":1611,"style":657},[519],[444,1613,1346],{"className":1614},[1345],[444,1616],{"className":1617,"style":657},[519],[444,1619,1621,1624,1627],{"className":1620},[456],[444,1622],{"className":1623,"style":501},[460],[444,1625,609],{"className":1626},[465],[444,1628,850],{"className":1629},[529],".\nOtherwise decompose ",[444,1632,1634],{"className":1633},[447],[444,1635,1637],{"className":1636,"ariaHidden":452},[451],[444,1638,1640,1643],{"className":1639},[456],[444,1641],{"className":1642,"style":1533},[460],[444,1644,381],{"className":1645},[465,466]," at ",[444,1648,1650],{"className":1649},[447],[444,1651,1653],{"className":1652,"ariaHidden":452},[451],[444,1654,1656,1659],{"className":1655},[456],[444,1657],{"className":1658,"style":1295},[460],[444,1660,730],{"className":1661,"style":729},[465,466]," into ",[444,1664,1666],{"className":1665},[447],[444,1667,1669,1725,1743],{"className":1668,"ariaHidden":452},[451],[444,1670,1672,1675,1715,1718,1722],{"className":1671},[456],[444,1673],{"className":1674,"style":1533},[460],[444,1676,1678,1681],{"className":1677},[465],[444,1679,381],{"className":1680},[465,466],[444,1682,1684],{"className":1683},[696],[444,1685,1687,1707],{"className":1686},[700,701],[444,1688,1690,1704],{"className":1689},[705],[444,1691,1693],{"className":1692,"style":980},[709],[444,1694,1695,1698],{"style":713},[444,1696],{"className":1697,"style":718},[717],[444,1699,1701],{"className":1700},[722,723,724,725],[444,1702,609],{"className":1703},[465,725],[444,1705,735],{"className":1706},[734],[444,1708,1710],{"className":1709},[705],[444,1711,1713],{"className":1712,"style":742},[709],[444,1714],{},[444,1716],{"className":1717,"style":1150},[519],[444,1719,1721],{"className":1720},[1154],":",[444,1723],{"className":1724,"style":1150},[519],[444,1726,1728,1731,1734,1737,1740],{"className":1727},[456],[444,1729],{"className":1730,"style":781},[460],[444,1732,752],{"className":1733},[465,466],[444,1735],{"className":1736,"style":1150},[519],[444,1738,1222],{"className":1739},[1154,1221],[444,1741],{"className":1742,"style":1150},[519],[444,1744,1746,1749],{"className":1745},[456],[444,1747],{"className":1748,"style":1295},[460],[444,1750,730],{"className":1751,"style":729},[465,466]," and\n",[444,1754,1756],{"className":1755},[447],[444,1757,1759,1815,1833],{"className":1758,"ariaHidden":452},[451],[444,1760,1762,1765,1806,1809,1812],{"className":1761},[456],[444,1763],{"className":1764,"style":1533},[460],[444,1766,1768,1771],{"className":1767},[465],[444,1769,381],{"className":1770},[465,466],[444,1772,1774],{"className":1773},[696],[444,1775,1777,1798],{"className":1776},[700,701],[444,1778,1780,1795],{"className":1779},[705],[444,1781,1783],{"className":1782,"style":980},[709],[444,1784,1785,1788],{"style":713},[444,1786],{"className":1787,"style":718},[717],[444,1789,1791],{"className":1790},[722,723,724,725],[444,1792,1794],{"className":1793},[465,725],"2",[444,1796,735],{"className":1797},[734],[444,1799,1801],{"className":1800},[705],[444,1802,1804],{"className":1803,"style":742},[709],[444,1805],{},[444,1807],{"className":1808,"style":1150},[519],[444,1810,1721],{"className":1811},[1154],[444,1813],{"className":1814,"style":1150},[519],[444,1816,1818,1821,1824,1827,1830],{"className":1817},[456],[444,1819],{"className":1820,"style":1295},[460],[444,1822,730],{"className":1823,"style":729},[465,466],[444,1825],{"className":1826,"style":1150},[519],[444,1828,1222],{"className":1829},[1154,1221],[444,1831],{"className":1832,"style":1150},[519],[444,1834,1836,1839],{"className":1835},[456],[444,1837],{"className":1838,"style":798},[460],[444,1840,764],{"className":1841,"style":763},[465,466],". Since the graph has no negative cycle, no\nshortest path repeats a vertex, so ",[444,1844,1846],{"className":1845},[447],[444,1847,1849],{"className":1848,"ariaHidden":452},[451],[444,1850,1852,1855],{"className":1851},[456],[444,1853],{"className":1854,"style":1295},[460],[444,1856,730],{"className":1857,"style":729},[465,466]," appears only at the split and the\nintermediate vertices of ",[444,1860,1862],{"className":1861},[447],[444,1863,1865],{"className":1864,"ariaHidden":452},[451],[444,1866,1868,1871],{"className":1867},[456],[444,1869],{"className":1870,"style":1533},[460],[444,1872,1874,1877],{"className":1873},[465],[444,1875,381],{"className":1876},[465,466],[444,1878,1880],{"className":1879},[696],[444,1881,1883,1903],{"className":1882},[700,701],[444,1884,1886,1900],{"className":1885},[705],[444,1887,1889],{"className":1888,"style":980},[709],[444,1890,1891,1894],{"style":713},[444,1892],{"className":1893,"style":718},[717],[444,1895,1897],{"className":1896},[722,723,724,725],[444,1898,609],{"className":1899},[465,725],[444,1901,735],{"className":1902},[734],[444,1904,1906],{"className":1905},[705],[444,1907,1909],{"className":1908,"style":742},[709],[444,1910],{}," and ",[444,1913,1915],{"className":1914},[447],[444,1916,1918],{"className":1917,"ariaHidden":452},[451],[444,1919,1921,1924],{"className":1920},[456],[444,1922],{"className":1923,"style":1533},[460],[444,1925,1927,1930],{"className":1926},[465],[444,1928,381],{"className":1929},[465,466],[444,1931,1933],{"className":1932},[696],[444,1934,1936,1956],{"className":1935},[700,701],[444,1937,1939,1953],{"className":1938},[705],[444,1940,1942],{"className":1941,"style":980},[709],[444,1943,1944,1947],{"style":713},[444,1945],{"className":1946,"style":718},[717],[444,1948,1950],{"className":1949},[722,723,724,725],[444,1951,1794],{"className":1952},[465,725],[444,1954,735],{"className":1955},[734],[444,1957,1959],{"className":1958},[705],[444,1960,1962],{"className":1961,"style":742},[709],[444,1963],{}," lie in ",[444,1966,1968],{"className":1967},[447],[444,1969,1971,2013],{"className":1970,"ariaHidden":452},[451],[444,1972,1974,1977,1980,1983,1986,1989,1992,1995,1998,2001,2004,2007,2010],{"className":1973},[456],[444,1975],{"className":1976,"style":501},[460],[444,1978,822],{"className":1979},[505],[444,1981,609],{"className":1982},[465],[444,1984,515],{"className":1985},[514],[444,1987],{"className":1988,"style":520},[519],[444,1990,644],{"className":1991},[643],[444,1993],{"className":1994,"style":520},[519],[444,1996,515],{"className":1997},[514],[444,1999],{"className":2000,"style":520},[519],[444,2002,730],{"className":2003,"style":729},[465,466],[444,2005],{"className":2006,"style":657},[519],[444,2008,1346],{"className":2009},[1345],[444,2011],{"className":2012,"style":657},[519],[444,2014,2016,2019,2022],{"className":2015},[456],[444,2017],{"className":2018,"style":501},[460],[444,2020,609],{"className":2021},[465],[444,2023,850],{"className":2024},[529],". Each leg\nmust itself be shortest (a cheaper leg would cheapen ",[444,2027,2029],{"className":2028},[447],[444,2030,2032],{"className":2031,"ariaHidden":452},[451],[444,2033,2035,2038],{"className":2034},[456],[444,2036],{"className":2037,"style":1533},[460],[444,2039,381],{"className":2040},[465,466],"), giving the\ntwo-term option. ",[444,2043,2045],{"className":2044},[447],[444,2046,2048],{"className":2047,"ariaHidden":452},[451],[444,2049,2051,2055],{"className":2050},[456],[444,2052],{"className":2053,"style":2054},[460],"height:0.675em;",[444,2056,2060],{"className":2057},[2058,2059],"enclosing","qed",[444,2061,2063],{"className":2062},[465,1221],"□",[381,2065,2066,2067,2082],{},"The lemma is a verbatim DP transition, route through ",[444,2068,2070],{"className":2069},[447],[444,2071,2073],{"className":2072,"ariaHidden":452},[451],[444,2074,2076,2079],{"className":2075},[456],[444,2077],{"className":2078,"style":1295},[460],[444,2080,730],{"className":2081,"style":729},[465,466]," or don't:",[444,2084,2087],{"className":2085},[2086],"katex-display",[444,2088,2090],{"className":2089},[447],[444,2091,2093,2166],{"className":2092,"ariaHidden":452},[451],[444,2094,2096,2099,2139,2142,2145,2148,2151,2154,2157,2160,2163],{"className":2095},[456],[444,2097],{"className":2098,"style":501},[460],[444,2100,2102,2105],{"className":2101},[465],[444,2103,692],{"className":2104},[465,466],[444,2106,2108],{"className":2107},[696],[444,2109,2111,2131],{"className":2110},[700,701],[444,2112,2114,2128],{"className":2113},[705],[444,2115,2117],{"className":2116,"style":710},[709],[444,2118,2119,2122],{"style":713},[444,2120],{"className":2121,"style":718},[717],[444,2123,2125],{"className":2124},[722,723,724,725],[444,2126,730],{"className":2127,"style":729},[465,466,725],[444,2129,735],{"className":2130},[734],[444,2132,2134],{"className":2133},[705],[444,2135,2137],{"className":2136,"style":742},[709],[444,2138],{},[444,2140,748],{"className":2141},[505],[444,2143,752],{"className":2144},[465,466],[444,2146,756],{"className":2147},[529],[444,2149,748],{"className":2150},[505],[444,2152,764],{"className":2153,"style":763},[465,466],[444,2155,756],{"className":2156},[529],[444,2158],{"className":2159,"style":1150},[519],[444,2161,1155],{"className":2162},[1154],[444,2164],{"className":2165,"style":1150},[519],[444,2167,2169,2173,2179,2182,2190,2193,2196,2402,2405,2408,2412,2415,2669,2672,2675,2681],{"className":2168},[456],[444,2170],{"className":2171,"style":2172},[460],"height:2.5702em;vertical-align:-1.7202em;",[444,2174,2176],{"className":2175},[581],[444,2177,586],{"className":2178},[465,585],[444,2180],{"className":2181,"style":520},[519],[444,2183,2185],{"className":2184},[465],[444,2186,506],{"className":2187},[2188,2189],"delimsizing","size1",[444,2191],{"className":2192,"style":520},[519],[444,2194],{"className":2195,"style":520},[519],[444,2197,2200],{"className":2198},[643,2199],"munder",[444,2201,2203,2393],{"className":2202},[700,701],[444,2204,2206,2390],{"className":2205},[705],[444,2207,2210,2234],{"className":2208,"style":2209},[709],"height:0.75em;",[444,2211,2213,2217],{"style":2212},"top:-1.4159em;",[444,2214],{"className":2215,"style":2216},[717],"height:3em;",[444,2218,2220],{"className":2219},[722,723,724,725],[444,2221,2223,2231],{"className":2222},[465,725],[444,2224,2227],{"className":2225},[465,2226,725],"text",[444,2228,2230],{"className":2229},[465,725],"avoid ",[444,2232,730],{"className":2233,"style":729},[465,466,725],[444,2235,2237,2240],{"style":2236},"top:-3em;",[444,2238],{"className":2239,"style":2216},[717],[444,2241,2243],{"className":2242},[643,2199],[444,2244,2246,2381],{"className":2245},[700,701],[444,2247,2249,2378],{"className":2248},[705],[444,2250,2252,2302],{"className":2251,"style":2209},[709],[444,2253,2257,2260],{"className":2254,"style":2256},[2255],"svg-align","top:-2.102em;",[444,2258],{"className":2259,"style":2216},[717],[444,2261,2265,2282,2292],{"className":2262,"style":2264},[2263],"stretchy","height:0.548em;min-width:1.6em;",[444,2266,2270],{"className":2267,"style":2269},[2268],"brace-left","height:0.548em;",[2271,2272,2278],"svg",{"xmlns":2273,"width":2274,"height":2275,"viewBox":2276,"preserveAspectRatio":2277},"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","400em","0.548em","0 0 400000 548","xMinYMin slice",[2279,2280],"path",{"d":2281},"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",[444,2283,2286],{"className":2284,"style":2269},[2285],"brace-center",[2271,2287,2289],{"xmlns":2273,"width":2274,"height":2275,"viewBox":2276,"preserveAspectRatio":2288},"xMidYMin slice",[2279,2290],{"d":2291},"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",[444,2293,2296],{"className":2294,"style":2269},[2295],"brace-right",[2271,2297,2299],{"xmlns":2273,"width":2274,"height":2275,"viewBox":2276,"preserveAspectRatio":2298},"xMaxYMin slice",[2279,2300],{"d":2301},"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",[444,2303,2304,2307],{"style":2236},[444,2305],{"className":2306,"style":2216},[717],[444,2308,2310,2360,2363,2366,2369,2372,2375],{"className":2309},[465],[444,2311,2313,2316],{"className":2312},[465],[444,2314,692],{"className":2315},[465,466],[444,2317,2319],{"className":2318},[696],[444,2320,2322,2351],{"className":2321},[700,701],[444,2323,2325,2348],{"className":2324},[705],[444,2326,2328],{"className":2327,"style":710},[709],[444,2329,2330,2333],{"style":713},[444,2331],{"className":2332,"style":718},[717],[444,2334,2336],{"className":2335},[722,723,724,725],[444,2337,2339,2342,2345],{"className":2338},[465,725],[444,2340,730],{"className":2341,"style":729},[465,466,725],[444,2343,1346],{"className":2344},[1345,725],[444,2346,609],{"className":2347},[465,725],[444,2349,735],{"className":2350},[734],[444,2352,2354],{"className":2353},[705],[444,2355,2358],{"className":2356,"style":2357},[709],"height:0.2083em;",[444,2359],{},[444,2361,748],{"className":2362},[505],[444,2364,752],{"className":2365},[465,466],[444,2367,756],{"className":2368},[529],[444,2370,748],{"className":2371},[505],[444,2373,764],{"className":2374,"style":763},[465,466],[444,2376,756],{"className":2377},[529],[444,2379,735],{"className":2380},[734],[444,2382,2384],{"className":2383},[705],[444,2385,2388],{"className":2386,"style":2387},[709],"height:0.898em;",[444,2389],{},[444,2391,735],{"className":2392},[734],[444,2394,2396],{"className":2395},[705],[444,2397,2400],{"className":2398,"style":2399},[709],"height:1.5841em;",[444,2401],{},[444,2403],{"className":2404,"style":520},[519],[444,2406,515],{"className":2407},[514],[444,2409,2411],{"className":2410},[519]," ",[444,2413],{"className":2414,"style":520},[519],[444,2416,2418],{"className":2417},[643,2199],[444,2419,2421,2660],{"className":2420},[700,701],[444,2422,2424,2657],{"className":2423},[705],[444,2425,2427,2448],{"className":2426,"style":2209},[709],[444,2428,2429,2432],{"style":2212},[444,2430],{"className":2431,"style":2216},[717],[444,2433,2435],{"className":2434},[722,723,724,725],[444,2436,2438,2445],{"className":2437},[465,725],[444,2439,2441],{"className":2440},[465,2226,725],[444,2442,2444],{"className":2443},[465,725],"through ",[444,2446,730],{"className":2447,"style":729},[465,466,725],[444,2449,2450,2453],{"style":2236},[444,2451],{"className":2452,"style":2216},[717],[444,2454,2456],{"className":2455},[643,2199],[444,2457,2459,2649],{"className":2458},[700,701],[444,2460,2462,2646],{"className":2461},[705],[444,2463,2465,2495],{"className":2464,"style":2209},[709],[444,2466,2468,2471],{"className":2467,"style":2256},[2255],[444,2469],{"className":2470,"style":2216},[717],[444,2472,2474,2481,2488],{"className":2473,"style":2264},[2263],[444,2475,2477],{"className":2476,"style":2269},[2268],[2271,2478,2479],{"xmlns":2273,"width":2274,"height":2275,"viewBox":2276,"preserveAspectRatio":2277},[2279,2480],{"d":2281},[444,2482,2484],{"className":2483,"style":2269},[2285],[2271,2485,2486],{"xmlns":2273,"width":2274,"height":2275,"viewBox":2276,"preserveAspectRatio":2288},[2279,2487],{"d":2291},[444,2489,2491],{"className":2490,"style":2269},[2295],[2271,2492,2493],{"xmlns":2273,"width":2274,"height":2275,"viewBox":2276,"preserveAspectRatio":2298},[2279,2494],{"d":2301},[444,2496,2497,2500],{"style":2236},[444,2498],{"className":2499,"style":2216},[717],[444,2501,2503,2552,2555,2558,2561,2564,2567,2570,2573,2576,2579,2628,2631,2634,2637,2640,2643],{"className":2502},[465],[444,2504,2506,2509],{"className":2505},[465],[444,2507,692],{"className":2508},[465,466],[444,2510,2512],{"className":2511},[696],[444,2513,2515,2544],{"className":2514},[700,701],[444,2516,2518,2541],{"className":2517},[705],[444,2519,2521],{"className":2520,"style":710},[709],[444,2522,2523,2526],{"style":713},[444,2524],{"className":2525,"style":718},[717],[444,2527,2529],{"className":2528},[722,723,724,725],[444,2530,2532,2535,2538],{"className":2531},[465,725],[444,2533,730],{"className":2534,"style":729},[465,466,725],[444,2536,1346],{"className":2537},[1345,725],[444,2539,609],{"className":2540},[465,725],[444,2542,735],{"className":2543},[734],[444,2545,2547],{"className":2546},[705],[444,2548,2550],{"className":2549,"style":2357},[709],[444,2551],{},[444,2553,748],{"className":2554},[505],[444,2556,752],{"className":2557},[465,466],[444,2559,756],{"className":2560},[529],[444,2562,748],{"className":2563},[505],[444,2565,730],{"className":2566,"style":729},[465,466],[444,2568,756],{"className":2569},[529],[444,2571],{"className":2572,"style":657},[519],[444,2574,1185],{"className":2575},[1345],[444,2577],{"className":2578,"style":657},[519],[444,2580,2582,2585],{"className":2581},[465],[444,2583,692],{"className":2584},[465,466],[444,2586,2588],{"className":2587},[696],[444,2589,2591,2620],{"className":2590},[700,701],[444,2592,2594,2617],{"className":2593},[705],[444,2595,2597],{"className":2596,"style":710},[709],[444,2598,2599,2602],{"style":713},[444,2600],{"className":2601,"style":718},[717],[444,2603,2605],{"className":2604},[722,723,724,725],[444,2606,2608,2611,2614],{"className":2607},[465,725],[444,2609,730],{"className":2610,"style":729},[465,466,725],[444,2612,1346],{"className":2613},[1345,725],[444,2615,609],{"className":2616},[465,725],[444,2618,735],{"className":2619},[734],[444,2621,2623],{"className":2622},[705],[444,2624,2626],{"className":2625,"style":2357},[709],[444,2627],{},[444,2629,748],{"className":2630},[505],[444,2632,730],{"className":2633,"style":729},[465,466],[444,2635,756],{"className":2636},[529],[444,2638,748],{"className":2639},[505],[444,2641,764],{"className":2642,"style":763},[465,466],[444,2644,756],{"className":2645},[529],[444,2647,735],{"className":2648},[734],[444,2650,2652],{"className":2651},[705],[444,2653,2655],{"className":2654,"style":2387},[709],[444,2656],{},[444,2658,735],{"className":2659},[734],[444,2661,2663],{"className":2662},[705],[444,2664,2667],{"className":2665,"style":2666},[709],"height:1.7202em;",[444,2668],{},[444,2670],{"className":2671,"style":520},[519],[444,2673],{"className":2674,"style":520},[519],[444,2676,2678],{"className":2677},[465],[444,2679,530],{"className":2680},[2188,2189],[444,2682,1511],{"className":2683},[465],[2685,2686,2690,3021],"figure",{"className":2687},[2688,2689],"tikz-figure","tikz-diagram-rendered",[2271,2691,2695],{"xmlns":2273,"width":2692,"height":2693,"viewBox":2694},"237.457","231.818","-75 -75 178.093 173.864",[2696,2697,2700,2704,2713,2716,2723,2726,2733,2736,2739,2798,2858,2918],"g",{"stroke":2698,"style":2699},"currentColor","stroke-miterlimit:10;stroke-width:.4",[2279,2701],{"fill":2702,"d":2703},"none","M-42.641-9.474c0-6.286-5.096-11.381-11.381-11.381S-65.403-15.76-65.403-9.474s5.095 11.381 11.38 11.381S-42.64-3.188-42.64-9.473Zm-11.381 0",[2696,2705,2707],{"transform":2706},"translate(-1.723 3.298)",[2279,2708],{"d":2709,"fill":2698,"stroke":2698,"className":2710,"style":2712},"M-53.241-10.192Q-53.241-10.377-53.163-10.582L-52.352-12.736Q-52.220-13.102-52.220-13.336Q-52.220-13.634-52.440-13.634Q-52.835-13.634-53.092-13.226Q-53.348-12.819-53.470-12.316Q-53.490-12.252-53.553-12.252L-53.670-12.252Q-53.753-12.252-53.753-12.345L-53.753-12.374Q-53.592-12.970-53.260-13.432Q-52.928-13.893-52.420-13.893Q-52.064-13.893-51.817-13.659Q-51.571-13.424-51.571-13.063Q-51.571-12.877-51.654-12.672L-52.464-10.524Q-52.601-10.192-52.601-9.923Q-52.601-9.625-52.372-9.625Q-51.981-9.625-51.720-10.043Q-51.459-10.460-51.351-10.944Q-51.332-11.002-51.273-11.002L-51.151-11.002Q-51.112-11.002-51.087-10.975Q-51.063-10.949-51.063-10.914Q-51.063-10.905-51.073-10.885Q-51.209-10.319-51.549-9.840Q-51.888-9.362-52.391-9.362Q-52.743-9.362-52.992-9.603Q-53.241-9.845-53.241-10.192M-52.113-15.534Q-52.113-15.744-51.937-15.914Q-51.761-16.085-51.551-16.085Q-51.380-16.085-51.271-15.980Q-51.161-15.875-51.161-15.714Q-51.161-15.490-51.339-15.321Q-51.517-15.153-51.732-15.153Q-51.893-15.153-52.003-15.263Q-52.113-15.372-52.113-15.534",[2711],"tikz-text","stroke-width:0.300",[2279,2714],{"fill":2702,"d":2715},"M99.623-9.474c0-6.286-5.096-11.381-11.382-11.381s-11.38 5.095-11.38 11.381S81.955 1.907 88.24 1.907s11.382-5.095 11.382-11.38Zm-11.382 0",[2696,2717,2719],{"transform":2718},"translate(139.918 2.325)",[2279,2720],{"d":2721,"fill":2698,"stroke":2698,"className":2722,"style":2712},"M-54.154-8.053Q-54.154-8.297-53.985-8.475Q-53.817-8.654-53.573-8.654Q-53.412-8.654-53.302-8.554Q-53.192-8.453-53.192-8.292Q-53.192-8.102-53.312-7.948Q-53.431-7.794-53.612-7.745Q-53.436-7.682-53.260-7.682Q-52.835-7.682-52.523-8.075Q-52.210-8.468-52.084-8.956L-51.141-12.716Q-51.073-13.004-51.073-13.204Q-51.073-13.634-51.371-13.634Q-51.810-13.634-52.140-13.236Q-52.469-12.838-52.674-12.316Q-52.694-12.252-52.752-12.252L-52.870-12.252Q-52.953-12.252-52.953-12.345L-52.953-12.374Q-52.728-12.975-52.313-13.434Q-51.898-13.893-51.351-13.893Q-50.936-13.893-50.670-13.634Q-50.404-13.375-50.404-12.975Q-50.404-12.833-50.433-12.692L-51.380-8.893Q-51.483-8.488-51.771-8.151Q-52.059-7.814-52.459-7.619Q-52.860-7.423-53.280-7.423Q-53.617-7.423-53.885-7.584Q-54.154-7.745-54.154-8.053M-50.990-15.534Q-50.990-15.753-50.819-15.919Q-50.648-16.085-50.433-16.085Q-50.262-16.085-50.152-15.980Q-50.043-15.875-50.043-15.714Q-50.043-15.490-50.221-15.321Q-50.399-15.153-50.614-15.153Q-50.775-15.153-50.882-15.265Q-50.990-15.377-50.990-15.534",[2711],[2279,2724],{"fill":2702,"d":2725},"M28.49-60.689c0-6.286-5.095-11.381-11.38-11.381S5.728-66.975 5.728-60.689s5.096 11.381 11.382 11.381 11.38-5.095 11.38-11.38Zm-11.38 0",[2696,2727,2729],{"transform":2728},"translate(68.371 -47.743)",[2279,2730],{"d":2731,"fill":2698,"stroke":2698,"className":2732,"style":2712},"M-53.490-9.655Q-53.490-9.713-53.480-9.743L-52.030-15.524Q-51.991-15.695-51.981-15.792Q-51.981-15.953-52.630-15.953Q-52.733-15.953-52.733-16.085Q-52.728-16.110-52.711-16.173Q-52.694-16.237-52.667-16.271Q-52.640-16.305-52.591-16.305L-51.244-16.412L-51.214-16.412Q-51.214-16.403-51.180-16.386Q-51.146-16.369-51.141-16.364Q-51.122-16.315-51.122-16.286L-52.171-12.106Q-51.810-12.257-51.261-12.826Q-50.711-13.395-50.401-13.644Q-50.091-13.893-49.623-13.893Q-49.344-13.893-49.149-13.703Q-48.954-13.512-48.954-13.234Q-48.954-13.058-49.027-12.909Q-49.100-12.760-49.232-12.667Q-49.364-12.575-49.540-12.575Q-49.701-12.575-49.811-12.675Q-49.920-12.775-49.920-12.936Q-49.920-13.175-49.752-13.339Q-49.584-13.502-49.344-13.502Q-49.442-13.634-49.642-13.634Q-49.940-13.634-50.216-13.463Q-50.492-13.292-50.812-12.973Q-51.131-12.653-51.395-12.387Q-51.659-12.120-51.883-11.984Q-51.293-11.915-50.858-11.674Q-50.423-11.432-50.423-10.934Q-50.423-10.831-50.462-10.675Q-50.550-10.299-50.550-10.075Q-50.550-9.625-50.243-9.625Q-49.881-9.625-49.693-10.021Q-49.505-10.416-49.383-10.944Q-49.364-11.002-49.300-11.002L-49.183-11.002Q-49.144-11.002-49.117-10.978Q-49.090-10.953-49.090-10.914Q-49.090-10.905-49.100-10.885Q-49.476-9.362-50.262-9.362Q-50.545-9.362-50.763-9.494Q-50.980-9.625-51.097-9.852Q-51.214-10.079-51.214-10.363Q-51.214-10.524-51.170-10.695Q-51.141-10.812-51.141-10.914Q-51.141-11.300-51.483-11.500Q-51.825-11.701-52.264-11.745L-52.772-9.703Q-52.811-9.552-52.923-9.457Q-53.036-9.362-53.182-9.362Q-53.309-9.362-53.399-9.447Q-53.490-9.533-53.490-9.655",[2711],[2279,2734],{"fill":2702,"d":2735},"M-43.285-5.136C.39 12.51 33.83 12.51 75.65-4.386",[2279,2737],{"stroke":2702,"d":2738},"m77.504-5.136-3.566-.285 1.712 1.034-.514 1.933",[2696,2740,2741,2749,2756,2762,2768,2774,2780,2786,2792],{"stroke":2702},[2696,2742,2744],{"transform":2743},"translate(53.81 37.388)",[2279,2745],{"d":2746,"fill":2698,"stroke":2698,"className":2747,"style":2748},"M-52.518-9.396Q-52.874-9.396-53.143-9.576Q-53.413-9.755-53.553-10.050Q-53.694-10.345-53.694-10.704Q-53.694-11.091-53.532-11.505Q-53.370-11.919-53.086-12.257Q-52.803-12.595-52.434-12.798Q-52.065-13.001-51.663-13.001Q-51.170-13.001-50.893-12.552L-50.456-14.322Q-50.413-14.486-50.413-14.537Q-50.413-14.642-50.909-14.642Q-51.006-14.673-51.006-14.771L-50.983-14.872Q-50.952-14.927-50.893-14.939L-49.792-15.025Q-49.749-15.025-49.709-14.994Q-49.670-14.962-49.670-14.908L-50.823-10.306Q-50.862-10.060-50.862-10.009Q-50.862-9.650-50.616-9.650Q-50.471-9.650-50.370-9.757Q-50.268-9.865-50.204-10.019Q-50.139-10.173-50.090-10.363Q-50.042-10.552-50.022-10.650Q-49.995-10.720-49.932-10.720L-49.831-10.720Q-49.792-10.720-49.766-10.687Q-49.741-10.654-49.741-10.626Q-49.741-10.611-49.749-10.595Q-49.862-10.103-50.061-9.749Q-50.260-9.396-50.631-9.396Q-50.913-9.396-51.139-9.538Q-51.366-9.681-51.448-9.939Q-51.670-9.697-51.944-9.546Q-52.217-9.396-52.518-9.396M-52.502-9.650Q-52.292-9.650-52.083-9.763Q-51.874-9.876-51.704-10.050Q-51.534-10.224-51.405-10.419Q-51.417-10.404-51.426-10.390Q-51.436-10.376-51.448-10.361L-51.014-12.083Q-51.053-12.263-51.139-12.413Q-51.225-12.564-51.362-12.656Q-51.499-12.747-51.678-12.747Q-52.014-12.747-52.286-12.466Q-52.557-12.185-52.717-11.810Q-52.842-11.490-52.940-11.070Q-53.038-10.650-53.038-10.369Q-53.038-10.079-52.905-9.865Q-52.772-9.650-52.502-9.650",[2711],"stroke-width:0.240",[2696,2750,2751],{"transform":2743},[2279,2752],{"d":2753,"fill":2698,"stroke":2698,"className":2754,"style":2755},"M-49.110-8.212Q-49.110-8.248-49.104-8.274L-48.252-11.669Q-48.228-11.772-48.222-11.825Q-48.222-11.904-48.612-11.904Q-48.647-11.904-48.670-11.938Q-48.694-11.971-48.694-12.006Q-48.670-12.097-48.659-12.125Q-48.647-12.153-48.594-12.162L-47.718-12.226L-47.692-12.226Q-47.622-12.200-47.622-12.124L-48.234-9.683Q-48.005-9.780-47.629-10.099Q-47.253-10.418-47.034-10.563Q-46.816-10.709-46.517-10.709Q-46.318-10.709-46.180-10.577Q-46.043-10.445-46.043-10.240Q-46.043-10.134-46.087-10.038Q-46.130-9.941-46.215-9.881Q-46.300-9.821-46.409-9.821Q-46.514-9.821-46.587-9.890Q-46.661-9.959-46.661-10.055Q-46.661-10.190-46.568-10.294Q-46.476-10.398-46.344-10.416Q-46.412-10.492-46.529-10.492Q-46.711-10.492-46.891-10.398Q-47.071-10.304-47.282-10.133Q-47.493-9.961-47.654-9.822Q-47.815-9.683-47.956-9.598Q-47.698-9.569-47.496-9.510Q-47.294-9.452-47.143-9.311Q-46.992-9.170-46.992-8.945Q-46.992-8.857-47.015-8.778Q-47.045-8.646-47.045-8.538Q-47.045-8.409-46.992-8.313Q-46.939-8.218-46.828-8.218Q-46.479-8.218-46.283-8.957Q-46.274-8.998-46.218-9.012L-46.122-9.012Q-46.043-8.986-46.043-8.927Q-46.043-8.921-46.048-8.892Q-46.104-8.678-46.208-8.478Q-46.312-8.277-46.472-8.141Q-46.631-8.004-46.842-8.004Q-47.021-8.004-47.185-8.081Q-47.349-8.157-47.446-8.302Q-47.543-8.447-47.543-8.634Q-47.543-8.710-47.525-8.795Q-47.507-8.866-47.507-8.927Q-47.507-9.088-47.641-9.192Q-47.774-9.296-47.964-9.346Q-48.155-9.396-48.304-9.396L-48.594-8.248Q-48.621-8.145-48.700-8.075Q-48.779-8.004-48.887-8.004Q-48.978-8.004-49.044-8.063Q-49.110-8.122-49.110-8.212",[2711],"stroke-width:0.180",[2696,2757,2758],{"transform":2743},[2279,2759],{"d":2760,"fill":2698,"stroke":2698,"className":2761,"style":2755},"M-40.680-9.408L-44.664-9.408Q-44.723-9.417-44.766-9.459Q-44.808-9.501-44.808-9.563Q-44.808-9.625-44.766-9.667Q-44.723-9.709-44.664-9.718L-40.680-9.718Q-40.619-9.709-40.578-9.668Q-40.537-9.627-40.537-9.563Q-40.537-9.499-40.578-9.458Q-40.619-9.417-40.680-9.408",[2711],[2696,2763,2764],{"transform":2743},[2279,2765],{"d":2766,"fill":2698,"stroke":2698,"className":2767,"style":2755},"M-36.740-8.063L-39.031-8.063L-39.031-8.321Q-38.155-8.321-38.155-8.494L-38.155-11.573Q-38.348-11.485-38.580-11.448Q-38.811-11.412-39.066-11.412L-39.066-11.669Q-38.688-11.669-38.367-11.754Q-38.047-11.839-37.818-12.053L-37.698-12.053Q-37.666-12.053-37.641-12.030Q-37.616-12.006-37.616-11.968L-37.616-8.494Q-37.616-8.321-36.740-8.321",[2711],[2696,2769,2770],{"transform":2743},[2279,2771],{"d":2772,"fill":2698,"stroke":2698,"className":2773,"style":2748},"M-33.446-7.474L-34.622-7.474L-34.622-15.474L-33.446-15.474L-33.446-15.107L-34.255-15.107L-34.255-7.841L-33.446-7.841",[2711],[2696,2775,2776],{"transform":2743},[2279,2777],{"d":2778,"fill":2698,"stroke":2698,"className":2779,"style":2748},"M-32.566-10.076Q-32.566-10.208-32.511-10.361L-31.839-12.091Q-31.749-12.314-31.749-12.497Q-31.749-12.747-31.925-12.747Q-32.230-12.747-32.441-12.439Q-32.651-12.130-32.757-11.747Q-32.769-11.673-32.839-11.673L-32.941-11.673Q-32.976-11.673-33.003-11.708Q-33.030-11.744-33.030-11.771L-33.030-11.802Q-32.909-12.267-32.614-12.634Q-32.319-13.001-31.909-13.001Q-31.702-13.001-31.532-12.919Q-31.362-12.837-31.259-12.683Q-31.155-12.529-31.155-12.322Q-31.155-12.201-31.214-12.033L-31.886-10.306Q-31.972-10.072-31.972-9.900Q-31.972-9.650-31.796-9.650Q-31.483-9.650-31.269-9.968Q-31.054-10.287-30.972-10.650Q-30.944-10.720-30.886-10.720L-30.780-10.720Q-30.741-10.720-30.718-10.691Q-30.694-10.662-30.694-10.626Q-30.694-10.611-30.702-10.595Q-30.780-10.294-30.927-10.027Q-31.073-9.759-31.298-9.578Q-31.523-9.396-31.812-9.396Q-32.128-9.396-32.347-9.583Q-32.566-9.771-32.566-10.076M-31.644-14.314Q-31.644-14.494-31.497-14.632Q-31.351-14.771-31.175-14.771Q-31.038-14.771-30.946-14.683Q-30.855-14.595-30.855-14.458Q-30.855-14.283-30.999-14.142Q-31.144-14.001-31.316-14.001Q-31.448-14.001-31.546-14.093Q-31.644-14.185-31.644-14.314",[2711],[2696,2781,2782],{"transform":2743},[2279,2783],{"d":2784,"fill":2698,"stroke":2698,"className":2785,"style":2748},"M-29-7.474L-30.175-7.474L-30.175-7.841L-29.367-7.841L-29.367-15.107L-30.175-15.107L-30.175-15.474L-29-15.474L-29-7.474M-25.832-7.474L-27.007-7.474L-27.007-15.474L-25.832-15.474L-25.832-15.107L-26.640-15.107L-26.640-7.841L-25.832-7.841",[2711],[2696,2787,2788],{"transform":2743},[2279,2789],{"d":2790,"fill":2698,"stroke":2698,"className":2791,"style":2748},"M-25.750-8.353Q-25.750-8.548-25.614-8.695Q-25.477-8.841-25.285-8.841Q-25.149-8.841-25.053-8.755Q-24.957-8.669-24.957-8.537Q-24.957-8.415-25.032-8.296Q-25.106-8.177-25.211-8.122Q-25.106-8.099-24.989-8.099Q-24.758-8.099-24.555-8.247Q-24.352-8.396-24.215-8.622Q-24.078-8.849-24.020-9.083L-23.270-12.091Q-23.231-12.247-23.231-12.384Q-23.231-12.533-23.283-12.640Q-23.336-12.747-23.469-12.747Q-23.707-12.747-23.918-12.593Q-24.129-12.439-24.283-12.206Q-24.438-11.974-24.539-11.720Q-24.555-11.673-24.614-11.673L-24.715-11.673Q-24.750-11.673-24.778-11.708Q-24.805-11.744-24.805-11.771L-24.805-11.802Q-24.688-12.095-24.489-12.374Q-24.289-12.654-24.026-12.828Q-23.762-13.001-23.453-13.001Q-23.231-13.001-23.037-12.910Q-22.844-12.818-22.729-12.646Q-22.614-12.474-22.614-12.251Q-22.614-12.181-22.645-12.033L-23.399-9.025Q-23.457-8.771-23.619-8.552Q-23.782-8.333-23.998-8.175Q-24.215-8.017-24.483-7.929Q-24.750-7.841-25.004-7.841Q-25.293-7.841-25.522-7.966Q-25.750-8.091-25.750-8.353M-23.110-14.314Q-23.110-14.494-22.965-14.632Q-22.821-14.771-22.637-14.771Q-22.508-14.771-22.412-14.683Q-22.317-14.595-22.317-14.458Q-22.317-14.283-22.461-14.142Q-22.606-14.001-22.782-14.001Q-22.914-14.001-23.012-14.093Q-23.110-14.185-23.110-14.314",[2711],[2696,2793,2794],{"transform":2743},[2279,2795],{"d":2796,"fill":2698,"stroke":2698,"className":2797,"style":2748},"M-20.379-7.474L-21.554-7.474L-21.554-7.841L-20.746-7.841L-20.746-15.107L-21.554-15.107L-21.554-15.474L-20.379-15.474",[2711],[2696,2799,2802,2805,2808],{"fill":2800,"stroke":2800,"style":2801},"var(--tk-accent)","stroke-width:.8",[2279,2803],{"fill":2702,"d":2804},"M-44.624-16.24 5.602-52.403",[2279,2806],{"stroke":2702,"d":2807},"m7.712-53.922-4.591.742 2.48.777-.05 2.599",[2696,2809,2810,2816,2821,2826,2831,2836,2841,2846,2852],{"fill":2800,"stroke":2702},[2696,2811,2813],{"transform":2812},"translate(6.791 -34.812)",[2279,2814],{"d":2746,"fill":2800,"stroke":2800,"className":2815,"style":2748},[2711],[2696,2817,2818],{"transform":2812},[2279,2819],{"d":2753,"fill":2800,"stroke":2800,"className":2820,"style":2755},[2711],[2696,2822,2823],{"transform":2812},[2279,2824],{"d":2760,"fill":2800,"stroke":2800,"className":2825,"style":2755},[2711],[2696,2827,2828],{"transform":2812},[2279,2829],{"d":2766,"fill":2800,"stroke":2800,"className":2830,"style":2755},[2711],[2696,2832,2833],{"transform":2812},[2279,2834],{"d":2772,"fill":2800,"stroke":2800,"className":2835,"style":2748},[2711],[2696,2837,2838],{"transform":2812},[2279,2839],{"d":2778,"fill":2800,"stroke":2800,"className":2840,"style":2748},[2711],[2696,2842,2843],{"transform":2812},[2279,2844],{"d":2784,"fill":2800,"stroke":2800,"className":2845,"style":2748},[2711],[2696,2847,2848],{"transform":2812},[2279,2849],{"d":2850,"fill":2800,"stroke":2800,"className":2851,"style":2748},"M-25.196-9.650Q-25.192-9.669-25.190-9.683Q-25.188-9.697-25.188-9.720L-24.035-14.322Q-23.996-14.509-23.996-14.537Q-23.996-14.642-24.492-14.642Q-24.590-14.673-24.590-14.771L-24.567-14.872Q-24.559-14.919-24.477-14.939L-23.371-15.025Q-23.321-15.025-23.287-14.995Q-23.254-14.966-23.254-14.908L-24.078-11.619Q-23.785-11.747-23.336-12.173Q-22.887-12.599-22.612-12.800Q-22.336-13.001-21.957-13.001Q-21.711-13.001-21.551-12.837Q-21.391-12.673-21.391-12.427Q-21.391-12.204-21.524-12.038Q-21.657-11.872-21.867-11.872Q-22-11.872-22.094-11.956Q-22.188-12.040-22.188-12.177Q-22.188-12.361-22.057-12.501Q-21.926-12.642-21.742-12.642Q-21.825-12.747-21.973-12.747Q-22.200-12.747-22.438-12.615Q-22.676-12.482-22.821-12.351Q-22.965-12.220-23.297-11.910Q-23.629-11.599-23.782-11.497Q-22.582-11.365-22.582-10.642Q-22.582-10.525-22.625-10.324Q-22.668-10.122-22.668-10.033Q-22.668-9.650-22.414-9.650Q-22.133-9.650-21.977-9.954Q-21.821-10.259-21.727-10.650Q-21.692-10.720-21.637-10.720L-21.532-10.720Q-21.492-10.720-21.469-10.691Q-21.446-10.662-21.446-10.626Q-21.446-10.611-21.453-10.595Q-21.563-10.122-21.803-9.759Q-22.043-9.396-22.430-9.396Q-22.785-9.396-23.028-9.624Q-23.270-9.853-23.270-10.208Q-23.270-10.279-23.246-10.415Q-23.223-10.552-23.223-10.626Q-23.223-10.837-23.371-10.974Q-23.520-11.111-23.741-11.179Q-23.961-11.247-24.164-11.267L-24.567-9.665Q-24.598-9.544-24.696-9.470Q-24.793-9.396-24.918-9.396Q-25.032-9.396-25.114-9.466Q-25.196-9.537-25.196-9.650",[2711],[2696,2853,2854],{"transform":2812},[2279,2855],{"d":2856,"fill":2800,"stroke":2800,"className":2857,"style":2748},"M-19.639-7.474L-20.814-7.474L-20.814-7.841L-20.006-7.841L-20.006-15.107L-20.814-15.107L-20.814-15.474L-19.639-15.474",[2711],[2696,2859,2860,2863,2866],{"fill":2800,"stroke":2800,"style":2801},[2279,2861],{"fill":2702,"d":2862},"M26.508-53.922 76.734-17.76",[2279,2864],{"stroke":2702,"d":2865},"m78.844-16.24-2.161-4.119.05 2.6-2.48.776",[2696,2867,2868,2874,2879,2884,2889,2894,2900,2906,2912],{"fill":2800,"stroke":2702},[2696,2869,2871],{"transform":2870},"translate(99.948 -35.175)",[2279,2872],{"d":2746,"fill":2800,"stroke":2800,"className":2873,"style":2748},[2711],[2696,2875,2876],{"transform":2870},[2279,2877],{"d":2753,"fill":2800,"stroke":2800,"className":2878,"style":2755},[2711],[2696,2880,2881],{"transform":2870},[2279,2882],{"d":2760,"fill":2800,"stroke":2800,"className":2883,"style":2755},[2711],[2696,2885,2886],{"transform":2870},[2279,2887],{"d":2766,"fill":2800,"stroke":2800,"className":2888,"style":2755},[2711],[2696,2890,2891],{"transform":2870},[2279,2892],{"d":2772,"fill":2800,"stroke":2800,"className":2893,"style":2748},[2711],[2696,2895,2896],{"transform":2870},[2279,2897],{"d":2898,"fill":2800,"stroke":2800,"className":2899,"style":2748},"M-32.812-9.650Q-32.808-9.669-32.806-9.683Q-32.804-9.697-32.804-9.720L-31.651-14.322Q-31.612-14.509-31.612-14.537Q-31.612-14.642-32.108-14.642Q-32.206-14.673-32.206-14.771L-32.183-14.872Q-32.175-14.919-32.093-14.939L-30.987-15.025Q-30.937-15.025-30.903-14.995Q-30.870-14.966-30.870-14.908L-31.694-11.619Q-31.401-11.747-30.952-12.173Q-30.503-12.599-30.228-12.800Q-29.952-13.001-29.573-13.001Q-29.327-13.001-29.167-12.837Q-29.007-12.673-29.007-12.427Q-29.007-12.204-29.140-12.038Q-29.273-11.872-29.483-11.872Q-29.616-11.872-29.710-11.956Q-29.804-12.040-29.804-12.177Q-29.804-12.361-29.673-12.501Q-29.542-12.642-29.358-12.642Q-29.441-12.747-29.589-12.747Q-29.816-12.747-30.054-12.615Q-30.292-12.482-30.437-12.351Q-30.581-12.220-30.913-11.910Q-31.245-11.599-31.398-11.497Q-30.198-11.365-30.198-10.642Q-30.198-10.525-30.241-10.324Q-30.284-10.122-30.284-10.033Q-30.284-9.650-30.030-9.650Q-29.749-9.650-29.593-9.954Q-29.437-10.259-29.343-10.650Q-29.308-10.720-29.253-10.720L-29.148-10.720Q-29.108-10.720-29.085-10.691Q-29.062-10.662-29.062-10.626Q-29.062-10.611-29.069-10.595Q-29.179-10.122-29.419-9.759Q-29.659-9.396-30.046-9.396Q-30.401-9.396-30.644-9.624Q-30.886-9.853-30.886-10.208Q-30.886-10.279-30.862-10.415Q-30.839-10.552-30.839-10.626Q-30.839-10.837-30.987-10.974Q-31.136-11.111-31.357-11.179Q-31.577-11.247-31.780-11.267L-32.183-9.665Q-32.214-9.544-32.312-9.470Q-32.409-9.396-32.534-9.396Q-32.648-9.396-32.730-9.466Q-32.812-9.537-32.812-9.650",[2711],[2696,2901,2902],{"transform":2870},[2279,2903],{"d":2904,"fill":2800,"stroke":2800,"className":2905,"style":2748},"M-27.255-7.474L-28.430-7.474L-28.430-7.841L-27.622-7.841L-27.622-15.107L-28.430-15.107L-28.430-15.474L-27.255-15.474L-27.255-7.474M-24.087-7.474L-25.262-7.474L-25.262-15.474L-24.087-15.474L-24.087-15.107L-24.895-15.107L-24.895-7.841L-24.087-7.841",[2711],[2696,2907,2908],{"transform":2870},[2279,2909],{"d":2910,"fill":2800,"stroke":2800,"className":2911,"style":2748},"M-24.005-8.353Q-24.005-8.548-23.869-8.695Q-23.732-8.841-23.540-8.841Q-23.404-8.841-23.308-8.755Q-23.212-8.669-23.212-8.537Q-23.212-8.415-23.287-8.296Q-23.361-8.177-23.466-8.122Q-23.361-8.099-23.244-8.099Q-23.013-8.099-22.810-8.247Q-22.607-8.396-22.470-8.622Q-22.333-8.849-22.275-9.083L-21.525-12.091Q-21.486-12.247-21.486-12.384Q-21.486-12.533-21.538-12.640Q-21.591-12.747-21.724-12.747Q-21.962-12.747-22.173-12.593Q-22.384-12.439-22.538-12.206Q-22.693-11.974-22.794-11.720Q-22.810-11.673-22.869-11.673L-22.970-11.673Q-23.005-11.673-23.033-11.708Q-23.060-11.744-23.060-11.771L-23.060-11.802Q-22.943-12.095-22.744-12.374Q-22.544-12.654-22.281-12.828Q-22.017-13.001-21.708-13.001Q-21.486-13.001-21.292-12.910Q-21.099-12.818-20.984-12.646Q-20.869-12.474-20.869-12.251Q-20.869-12.181-20.900-12.033L-21.654-9.025Q-21.712-8.771-21.874-8.552Q-22.037-8.333-22.253-8.175Q-22.470-8.017-22.738-7.929Q-23.005-7.841-23.259-7.841Q-23.548-7.841-23.777-7.966Q-24.005-8.091-24.005-8.353M-21.365-14.314Q-21.365-14.494-21.220-14.632Q-21.076-14.771-20.892-14.771Q-20.763-14.771-20.667-14.683Q-20.572-14.595-20.572-14.458Q-20.572-14.283-20.716-14.142Q-20.861-14.001-21.037-14.001Q-21.169-14.001-21.267-14.093Q-21.365-14.185-21.365-14.314",[2711],[2696,2913,2914],{"transform":2870},[2279,2915],{"d":2916,"fill":2800,"stroke":2800,"className":2917,"style":2748},"M-18.634-7.474L-19.809-7.474L-19.809-7.841L-19.001-7.841L-19.001-15.107L-19.809-15.107L-19.809-15.474L-18.634-15.474",[2711],[2696,2919,2920,2926,2931,2937,2943,2949,2955,2961,2967,2973,2979,2985,2991,2997,3003,3009,3015],{"stroke":2702},[2696,2921,2923],{"transform":2922},"translate(10.166 46.102)",[2279,2924],{"d":2746,"fill":2698,"stroke":2698,"className":2925,"style":2748},[2711],[2696,2927,2928],{"transform":2922},[2279,2929],{"d":2753,"fill":2698,"stroke":2698,"className":2930,"style":2755},[2711],[2696,2932,2933],{"transform":2922},[2279,2934],{"d":2935,"fill":2698,"stroke":2698,"className":2936,"style":2748},"M-42.890-7.474L-44.066-7.474L-44.066-15.474L-42.890-15.474L-42.890-15.107L-43.699-15.107L-43.699-7.841L-42.890-7.841",[2711],[2696,2938,2939],{"transform":2922},[2279,2940],{"d":2941,"fill":2698,"stroke":2698,"className":2942,"style":2748},"M-42.010-10.076Q-42.010-10.208-41.955-10.361L-41.283-12.091Q-41.193-12.314-41.193-12.497Q-41.193-12.747-41.369-12.747Q-41.674-12.747-41.885-12.439Q-42.095-12.130-42.201-11.747Q-42.213-11.673-42.283-11.673L-42.385-11.673Q-42.420-11.673-42.447-11.708Q-42.474-11.744-42.474-11.771L-42.474-11.802Q-42.353-12.267-42.058-12.634Q-41.763-13.001-41.353-13.001Q-41.146-13.001-40.976-12.919Q-40.806-12.837-40.703-12.683Q-40.599-12.529-40.599-12.322Q-40.599-12.201-40.658-12.033L-41.330-10.306Q-41.416-10.072-41.416-9.900Q-41.416-9.650-41.240-9.650Q-40.927-9.650-40.713-9.968Q-40.498-10.287-40.416-10.650Q-40.388-10.720-40.330-10.720L-40.224-10.720Q-40.185-10.720-40.162-10.691Q-40.138-10.662-40.138-10.626Q-40.138-10.611-40.146-10.595Q-40.224-10.294-40.371-10.027Q-40.517-9.759-40.742-9.578Q-40.967-9.396-41.256-9.396Q-41.572-9.396-41.791-9.583Q-42.010-9.771-42.010-10.076M-41.088-14.314Q-41.088-14.494-40.941-14.632Q-40.795-14.771-40.619-14.771Q-40.482-14.771-40.390-14.683Q-40.299-14.595-40.299-14.458Q-40.299-14.283-40.443-14.142Q-40.588-14.001-40.760-14.001Q-40.892-14.001-40.990-14.093Q-41.088-14.185-41.088-14.314",[2711],[2696,2944,2945],{"transform":2922},[2279,2946],{"d":2947,"fill":2698,"stroke":2698,"className":2948,"style":2748},"M-38.444-7.474L-39.619-7.474L-39.619-7.841L-38.811-7.841L-38.811-15.107L-39.619-15.107L-39.619-15.474L-38.444-15.474L-38.444-7.474M-35.276-7.474L-36.451-7.474L-36.451-15.474L-35.276-15.474L-35.276-15.107L-36.084-15.107L-36.084-7.841L-35.276-7.841",[2711],[2696,2950,2951],{"transform":2922},[2279,2952],{"d":2953,"fill":2698,"stroke":2698,"className":2954,"style":2748},"M-35.194-8.353Q-35.194-8.548-35.058-8.695Q-34.921-8.841-34.729-8.841Q-34.593-8.841-34.497-8.755Q-34.401-8.669-34.401-8.537Q-34.401-8.415-34.476-8.296Q-34.550-8.177-34.655-8.122Q-34.550-8.099-34.433-8.099Q-34.202-8.099-33.999-8.247Q-33.796-8.396-33.659-8.622Q-33.522-8.849-33.464-9.083L-32.714-12.091Q-32.675-12.247-32.675-12.384Q-32.675-12.533-32.727-12.640Q-32.780-12.747-32.913-12.747Q-33.151-12.747-33.362-12.593Q-33.573-12.439-33.727-12.206Q-33.882-11.974-33.983-11.720Q-33.999-11.673-34.058-11.673L-34.159-11.673Q-34.194-11.673-34.222-11.708Q-34.249-11.744-34.249-11.771L-34.249-11.802Q-34.132-12.095-33.933-12.374Q-33.733-12.654-33.470-12.828Q-33.206-13.001-32.897-13.001Q-32.675-13.001-32.481-12.910Q-32.288-12.818-32.173-12.646Q-32.058-12.474-32.058-12.251Q-32.058-12.181-32.089-12.033L-32.843-9.025Q-32.901-8.771-33.063-8.552Q-33.226-8.333-33.442-8.175Q-33.659-8.017-33.927-7.929Q-34.194-7.841-34.448-7.841Q-34.737-7.841-34.966-7.966Q-35.194-8.091-35.194-8.353M-32.554-14.314Q-32.554-14.494-32.409-14.632Q-32.265-14.771-32.081-14.771Q-31.952-14.771-31.856-14.683Q-31.761-14.595-31.761-14.458Q-31.761-14.283-31.905-14.142Q-32.050-14.001-32.226-14.001Q-32.358-14.001-32.456-14.093Q-32.554-14.185-32.554-14.314",[2711],[2696,2956,2957],{"transform":2922},[2279,2958],{"d":2959,"fill":2698,"stroke":2698,"className":2960,"style":2748},"M-29.823-7.474L-30.998-7.474L-30.998-7.841L-30.190-7.841L-30.190-15.107L-30.998-15.107L-30.998-15.474L-29.823-15.474",[2711],[2696,2962,2963],{"transform":2922},[2279,2964],{"d":2965,"fill":2698,"stroke":2698,"className":2966,"style":2748},"M-20.499-10.451L-25.812-10.451Q-25.890-10.458-25.939-10.507Q-25.987-10.556-25.987-10.634Q-25.987-10.704-25.940-10.755Q-25.894-10.806-25.812-10.818L-20.499-10.818Q-20.425-10.806-20.378-10.755Q-20.331-10.704-20.331-10.634Q-20.331-10.556-20.380-10.507Q-20.429-10.458-20.499-10.451M-20.499-12.138L-25.812-12.138Q-25.890-12.146-25.939-12.195Q-25.987-12.244-25.987-12.322Q-25.987-12.392-25.940-12.443Q-25.894-12.494-25.812-12.505L-20.499-12.505Q-20.425-12.494-20.378-12.443Q-20.331-12.392-20.331-12.322Q-20.331-12.244-20.380-12.195Q-20.429-12.146-20.499-12.138",[2711],[2696,2968,2969],{"transform":2922},[2279,2970],{"d":2971,"fill":2698,"stroke":2698,"className":2972,"style":2748},"M-15.320-9.474L-17.175-9.474L-17.175-9.771Q-16.902-9.771-16.734-9.818Q-16.566-9.865-16.566-10.033L-16.566-12.169Q-16.566-12.384-16.629-12.480Q-16.691-12.576-16.810-12.597Q-16.929-12.619-17.175-12.619L-17.175-12.915L-15.984-13.001L-15.984-12.267Q-15.871-12.482-15.677-12.650Q-15.484-12.818-15.246-12.910Q-15.008-13.001-14.754-13.001Q-13.793-13.001-13.617-12.290Q-13.433-12.619-13.105-12.810Q-12.777-13.001-12.398-13.001Q-11.222-13.001-11.222-11.923L-11.222-10.033Q-11.222-9.865-11.054-9.818Q-10.886-9.771-10.617-9.771L-10.617-9.474L-12.472-9.474L-12.472-9.771Q-12.199-9.771-12.031-9.816Q-11.863-9.861-11.863-10.033L-11.863-11.908Q-11.863-12.294-11.988-12.521Q-12.113-12.747-12.465-12.747Q-12.769-12.747-13.025-12.585Q-13.281-12.423-13.429-12.154Q-13.578-11.884-13.578-11.587L-13.578-10.033Q-13.578-9.865-13.408-9.818Q-13.238-9.771-12.968-9.771L-12.968-9.474L-14.824-9.474L-14.824-9.771Q-14.550-9.771-14.383-9.818Q-14.215-9.865-14.215-10.033L-14.215-11.908Q-14.215-12.294-14.340-12.521Q-14.465-12.747-14.816-12.747Q-15.121-12.747-15.377-12.585Q-15.633-12.423-15.781-12.154Q-15.929-11.884-15.929-11.587L-15.929-10.033Q-15.929-9.865-15.759-9.818Q-15.590-9.771-15.320-9.771L-15.320-9.474M-8.312-9.474L-10.090-9.474L-10.090-9.771Q-9.816-9.771-9.648-9.818Q-9.480-9.865-9.480-10.033L-9.480-12.169Q-9.480-12.384-9.537-12.480Q-9.593-12.576-9.707-12.597Q-9.820-12.619-10.066-12.619L-10.066-12.915L-8.867-13.001L-8.867-10.033Q-8.867-9.865-8.720-9.818Q-8.574-9.771-8.312-9.771L-8.312-9.474M-9.754-14.396Q-9.754-14.587-9.619-14.718Q-9.484-14.849-9.289-14.849Q-9.168-14.849-9.064-14.787Q-8.961-14.724-8.898-14.620Q-8.836-14.517-8.836-14.396Q-8.836-14.201-8.967-14.066Q-9.097-13.931-9.289-13.931Q-9.488-13.931-9.621-14.064Q-9.754-14.197-9.754-14.396M-5.883-9.474L-7.738-9.474L-7.738-9.771Q-7.465-9.771-7.297-9.818Q-7.129-9.865-7.129-10.033L-7.129-12.169Q-7.129-12.384-7.191-12.480Q-7.254-12.576-7.373-12.597Q-7.492-12.619-7.738-12.619L-7.738-12.915L-6.547-13.001L-6.547-12.267Q-6.433-12.482-6.240-12.650Q-6.047-12.818-5.808-12.910Q-5.570-13.001-5.316-13.001Q-4.148-13.001-4.148-11.923L-4.148-10.033Q-4.148-9.865-3.978-9.818Q-3.808-9.771-3.539-9.771L-3.539-9.474L-5.394-9.474L-5.394-9.771Q-5.121-9.771-4.953-9.818Q-4.785-9.865-4.785-10.033L-4.785-11.908Q-4.785-12.290-4.906-12.519Q-5.027-12.747-5.379-12.747Q-5.691-12.747-5.945-12.585Q-6.199-12.423-6.345-12.154Q-6.492-11.884-6.492-11.587L-6.492-10.033Q-6.492-9.865-6.322-9.818Q-6.152-9.771-5.883-9.771",[2711],[2696,2974,2975],{"transform":2922},[2279,2976],{"d":2977,"fill":2698,"stroke":2698,"className":2978,"style":2748},"M-0.704-7.482Q-1.317-7.939-1.719-8.574Q-2.122-9.208-2.317-9.954Q-2.512-10.701-2.512-11.474Q-2.512-12.247-2.317-12.994Q-2.122-13.740-1.719-14.374Q-1.317-15.009-0.704-15.466Q-0.692-15.470-0.684-15.472Q-0.676-15.474-0.665-15.474L-0.587-15.474Q-0.548-15.474-0.522-15.447Q-0.497-15.419-0.497-15.376Q-0.497-15.326-0.528-15.306Q-1.036-14.853-1.358-14.230Q-1.680-13.607-1.821-12.912Q-1.962-12.216-1.962-11.474Q-1.962-10.740-1.823-10.040Q-1.684-9.341-1.360-8.716Q-1.036-8.091-0.528-7.642Q-0.497-7.622-0.497-7.572Q-0.497-7.529-0.522-7.501Q-0.548-7.474-0.587-7.474L-0.665-7.474Q-0.673-7.478-0.682-7.480Q-0.692-7.482-0.704-7.482",[2711],[2696,2980,2981],{"transform":2922},[2279,2982],{"d":2983,"fill":2698,"stroke":2698,"className":2984,"style":2748},"M1.137-9.474L0.856-9.474L0.856-14.193Q0.856-14.408 0.794-14.503Q0.731-14.599 0.614-14.620Q0.497-14.642 0.251-14.642L0.251-14.939L1.473-15.025L1.473-12.537Q1.950-13.001 2.649-13.001Q3.130-13.001 3.538-12.757Q3.946-12.513 4.182-12.099Q4.419-11.685 4.419-11.201Q4.419-10.826 4.270-10.497Q4.122-10.169 3.852-9.917Q3.583-9.665 3.239-9.531Q2.895-9.396 2.536-9.396Q2.215-9.396 1.917-9.544Q1.618-9.693 1.411-9.954L1.137-9.474M1.497-12.146L1.497-10.306Q1.649-10.009 1.909-9.829Q2.169-9.650 2.481-9.650Q2.907-9.650 3.174-9.869Q3.442-10.087 3.557-10.433Q3.672-10.779 3.672-11.201Q3.672-11.849 3.424-12.298Q3.176-12.747 2.579-12.747Q2.243-12.747 1.954-12.589Q1.665-12.431 1.497-12.146",[2711],[2696,2986,2987],{"transform":2922},[2279,2988],{"d":2989,"fill":2698,"stroke":2698,"className":2990,"style":2748},"M5.181-11.228Q5.181-11.708 5.414-12.124Q5.646-12.540 6.056-12.790Q6.466-13.040 6.943-13.040Q7.673-13.040 8.072-12.599Q8.470-12.158 8.470-11.427Q8.470-11.322 8.377-11.298L5.927-11.298L5.927-11.228Q5.927-10.818 6.048-10.462Q6.170-10.107 6.441-9.890Q6.713-9.673 7.142-9.673Q7.505-9.673 7.802-9.902Q8.099-10.130 8.201-10.482Q8.209-10.529 8.295-10.544L8.377-10.544Q8.470-10.517 8.470-10.435Q8.470-10.427 8.463-10.396Q8.400-10.169 8.261-9.986Q8.123-9.802 7.931-9.669Q7.740-9.537 7.521-9.466Q7.302-9.396 7.064-9.396Q6.693-9.396 6.355-9.533Q6.017-9.669 5.750-9.921Q5.482-10.173 5.332-10.513Q5.181-10.853 5.181-11.228M5.935-11.537L7.896-11.537Q7.896-11.841 7.795-12.132Q7.693-12.423 7.476-12.605Q7.259-12.787 6.943-12.787Q6.642-12.787 6.412-12.599Q6.181-12.412 6.058-12.120Q5.935-11.829 5.935-11.537M10.873-9.474L9.041-9.474L9.041-9.771Q9.314-9.771 9.482-9.818Q9.650-9.865 9.650-10.033L9.650-14.193Q9.650-14.408 9.588-14.503Q9.525-14.599 9.406-14.620Q9.287-14.642 9.041-14.642L9.041-14.939L10.263-15.025L10.263-10.033Q10.263-9.865 10.431-9.818Q10.599-9.771 10.873-9.771L10.873-9.474M11.318-11.169Q11.318-11.673 11.574-12.105Q11.830-12.537 12.265-12.788Q12.701-13.040 13.201-13.040Q13.588-13.040 13.929-12.896Q14.271-12.751 14.533-12.490Q14.795-12.228 14.937-11.892Q15.080-11.556 15.080-11.169Q15.080-10.677 14.816-10.267Q14.552-9.857 14.123-9.626Q13.693-9.396 13.201-9.396Q12.709-9.396 12.275-9.628Q11.841-9.861 11.580-10.269Q11.318-10.677 11.318-11.169M13.201-9.673Q13.658-9.673 13.910-9.896Q14.162-10.119 14.250-10.470Q14.338-10.822 14.338-11.267Q14.338-11.697 14.244-12.035Q14.150-12.372 13.896-12.579Q13.642-12.787 13.201-12.787Q12.552-12.787 12.308-12.370Q12.064-11.954 12.064-11.267Q12.064-10.822 12.152-10.470Q12.240-10.119 12.492-9.896Q12.744-9.673 13.201-9.673",[2711],[2696,2992,2993],{"transform":2922},[2279,2994],{"d":2995,"fill":2698,"stroke":2698,"className":2996,"style":2748},"M16.920-9.505L15.850-12.361Q15.784-12.540 15.653-12.583Q15.522-12.626 15.264-12.626L15.264-12.923L16.944-12.923L16.944-12.626Q16.494-12.626 16.494-12.427Q16.498-12.412 16.500-12.394Q16.502-12.376 16.502-12.361L17.295-10.267L18.006-12.177Q17.971-12.271 17.971-12.316Q17.971-12.361 17.936-12.361Q17.869-12.540 17.739-12.583Q17.608-12.626 17.354-12.626L17.354-12.923L18.944-12.923L18.944-12.626Q18.494-12.626 18.494-12.427Q18.498-12.408 18.500-12.390Q18.502-12.372 18.502-12.361L19.334-10.146L20.088-12.146Q20.112-12.204 20.112-12.275Q20.112-12.435 19.975-12.531Q19.838-12.626 19.670-12.626L19.670-12.923L21.057-12.923L21.057-12.626Q20.823-12.626 20.645-12.499Q20.467-12.372 20.385-12.146L19.401-9.505Q19.346-9.396 19.233-9.396L19.174-9.396Q19.061-9.396 19.018-9.505L18.159-11.779L17.303-9.505Q17.264-9.396 17.143-9.396L17.088-9.396Q16.975-9.396 16.920-9.505",[2711],[2696,2998,2999],{"transform":2922},[2279,3000],{"d":3001,"fill":2698,"stroke":2698,"className":3002,"style":2748},"M22.059-8.068Q22.059-8.091 22.090-8.138Q22.383-8.400 22.549-8.767Q22.715-9.134 22.715-9.521L22.715-9.579Q22.587-9.474 22.419-9.474Q22.227-9.474 22.090-9.607Q21.954-9.740 21.954-9.939Q21.954-10.130 22.090-10.263Q22.227-10.396 22.419-10.396Q22.719-10.396 22.844-10.126Q22.969-9.857 22.969-9.521Q22.969-9.072 22.788-8.658Q22.606-8.244 22.266-7.947Q22.243-7.923 22.204-7.923Q22.157-7.923 22.108-7.968Q22.059-8.013 22.059-8.068",[2711],[2696,3004,3005],{"transform":2922},[2279,3006],{"d":3007,"fill":2698,"stroke":2698,"className":3008,"style":2748},"M28.709-10.435L28.709-12.626L28.006-12.626L28.006-12.880Q28.362-12.880 28.604-13.113Q28.846-13.345 28.957-13.693Q29.069-14.040 29.069-14.396L29.350-14.396L29.350-12.923L30.526-12.923L30.526-12.626L29.350-12.626L29.350-10.451Q29.350-10.130 29.469-9.902Q29.588-9.673 29.869-9.673Q30.049-9.673 30.166-9.796Q30.284-9.919 30.336-10.099Q30.389-10.279 30.389-10.451L30.389-10.923L30.670-10.923L30.670-10.435Q30.670-10.181 30.565-9.941Q30.459-9.701 30.262-9.548Q30.065-9.396 29.807-9.396Q29.491-9.396 29.239-9.519Q28.987-9.642 28.848-9.876Q28.709-10.111 28.709-10.435M33.319-9.474L31.463-9.474L31.463-9.771Q31.737-9.771 31.905-9.818Q32.073-9.865 32.073-10.033L32.073-14.193Q32.073-14.408 32.010-14.503Q31.948-14.599 31.828-14.620Q31.709-14.642 31.463-14.642L31.463-14.939L32.686-15.025L32.686-12.322Q32.811-12.533 32.998-12.683Q33.186-12.833 33.412-12.917Q33.639-13.001 33.885-13.001Q35.053-13.001 35.053-11.923L35.053-10.033Q35.053-9.865 35.223-9.818Q35.393-9.771 35.662-9.771L35.662-9.474L33.807-9.474L33.807-9.771Q34.080-9.771 34.248-9.818Q34.416-9.865 34.416-10.033L34.416-11.908Q34.416-12.290 34.295-12.519Q34.174-12.747 33.823-12.747Q33.510-12.747 33.256-12.585Q33.002-12.423 32.856-12.154Q32.709-11.884 32.709-11.587L32.709-10.033Q32.709-9.865 32.879-9.818Q33.049-9.771 33.319-9.771L33.319-9.474M38.116-9.474L36.135-9.474L36.135-9.771Q36.405-9.771 36.573-9.816Q36.741-9.861 36.741-10.033L36.741-12.169Q36.741-12.384 36.678-12.480Q36.616-12.576 36.498-12.597Q36.381-12.619 36.135-12.619L36.135-12.915L37.303-13.001L37.303-12.216Q37.381-12.427 37.534-12.613Q37.686-12.798 37.885-12.900Q38.084-13.001 38.311-13.001Q38.557-13.001 38.748-12.857Q38.940-12.712 38.940-12.482Q38.940-12.326 38.834-12.216Q38.729-12.107 38.573-12.107Q38.416-12.107 38.307-12.216Q38.198-12.326 38.198-12.482Q38.198-12.642 38.303-12.747Q37.979-12.747 37.764-12.519Q37.549-12.290 37.453-11.951Q37.358-11.611 37.358-11.306L37.358-10.033Q37.358-9.865 37.584-9.818Q37.811-9.771 38.116-9.771L38.116-9.474M39.420-11.169Q39.420-11.673 39.676-12.105Q39.932-12.537 40.367-12.788Q40.803-13.040 41.303-13.040Q41.690-13.040 42.032-12.896Q42.373-12.751 42.635-12.490Q42.897-12.228 43.039-11.892Q43.182-11.556 43.182-11.169Q43.182-10.677 42.918-10.267Q42.655-9.857 42.225-9.626Q41.795-9.396 41.303-9.396Q40.811-9.396 40.377-9.628Q39.944-9.861 39.682-10.269Q39.420-10.677 39.420-11.169M41.303-9.673Q41.760-9.673 42.012-9.896Q42.264-10.119 42.352-10.470Q42.440-10.822 42.440-11.267Q42.440-11.697 42.346-12.035Q42.252-12.372 41.998-12.579Q41.744-12.787 41.303-12.787Q40.655-12.787 40.410-12.370Q40.166-11.954 40.166-11.267Q40.166-10.822 40.254-10.470Q40.342-10.119 40.594-9.896Q40.846-9.673 41.303-9.673M44.350-10.427L44.350-12.169Q44.350-12.384 44.287-12.480Q44.225-12.576 44.106-12.597Q43.987-12.619 43.741-12.619L43.741-12.915L44.987-13.001L44.987-10.451L44.987-10.427Q44.987-10.115 45.041-9.953Q45.096-9.790 45.246-9.720Q45.397-9.650 45.717-9.650Q46.147-9.650 46.420-9.988Q46.694-10.326 46.694-10.771L46.694-12.169Q46.694-12.384 46.631-12.480Q46.569-12.576 46.450-12.597Q46.330-12.619 46.084-12.619L46.084-12.915L47.330-13.001L47.330-10.216Q47.330-10.005 47.393-9.910Q47.455-9.814 47.575-9.792Q47.694-9.771 47.940-9.771L47.940-9.474L46.717-9.396L46.717-10.017Q46.549-9.728 46.268-9.562Q45.987-9.396 45.666-9.396Q44.350-9.396 44.350-10.427M48.385-8.865Q48.385-9.146 48.596-9.357Q48.807-9.568 49.092-9.658Q48.936-9.783 48.858-9.972Q48.780-10.162 48.780-10.361Q48.780-10.716 49.010-11.009Q48.643-11.349 48.643-11.818Q48.643-12.169 48.846-12.439Q49.049-12.708 49.369-12.855Q49.690-13.001 50.034-13.001Q50.553-13.001 50.924-12.720Q51.287-13.091 51.834-13.091Q52.014-13.091 52.141-12.964Q52.268-12.837 52.268-12.658Q52.268-12.552 52.190-12.474Q52.112-12.396 52.002-12.396Q51.893-12.396 51.817-12.472Q51.741-12.548 51.741-12.658Q51.741-12.759 51.780-12.810Q51.787-12.818 51.791-12.824Q51.795-12.829 51.795-12.833Q51.420-12.833 51.100-12.579Q51.420-12.240 51.420-11.818Q51.420-11.548 51.303-11.331Q51.186-11.115 50.981-10.956Q50.776-10.798 50.534-10.716Q50.291-10.634 50.034-10.634Q49.815-10.634 49.602-10.693Q49.389-10.751 49.194-10.872Q49.100-10.732 49.100-10.552Q49.100-10.345 49.237-10.193Q49.373-10.040 49.580-10.040L50.276-10.040Q50.764-10.040 51.176-9.956Q51.588-9.872 51.867-9.615Q52.147-9.357 52.147-8.865Q52.147-8.501 51.826-8.269Q51.506-8.037 51.065-7.935Q50.623-7.833 50.268-7.833Q49.912-7.833 49.469-7.935Q49.026-8.037 48.705-8.269Q48.385-8.501 48.385-8.865M48.889-8.865Q48.889-8.669 49.034-8.521Q49.178-8.372 49.391-8.283Q49.604-8.193 49.844-8.146Q50.084-8.099 50.268-8.099Q50.510-8.099 50.840-8.177Q51.170-8.255 51.407-8.429Q51.643-8.603 51.643-8.865Q51.643-9.271 51.233-9.380Q50.823-9.490 50.260-9.490L49.580-9.490Q49.311-9.490 49.100-9.312Q48.889-9.134 48.889-8.865M50.034-10.900Q50.756-10.900 50.756-11.818Q50.756-12.740 50.034-12.740Q49.307-12.740 49.307-11.818Q49.307-10.900 50.034-10.900M54.561-9.474L52.705-9.474L52.705-9.771Q52.979-9.771 53.147-9.818Q53.315-9.865 53.315-10.033L53.315-14.193Q53.315-14.408 53.252-14.503Q53.190-14.599 53.071-14.620Q52.951-14.642 52.705-14.642L52.705-14.939L53.928-15.025L53.928-12.322Q54.053-12.533 54.241-12.683Q54.428-12.833 54.655-12.917Q54.881-13.001 55.127-13.001Q56.295-13.001 56.295-11.923L56.295-10.033Q56.295-9.865 56.465-9.818Q56.635-9.771 56.905-9.771L56.905-9.474L55.049-9.474L55.049-9.771Q55.323-9.771 55.491-9.818Q55.659-9.865 55.659-10.033L55.659-11.908Q55.659-12.290 55.537-12.519Q55.416-12.747 55.065-12.747Q54.752-12.747 54.498-12.585Q54.244-12.423 54.098-12.154Q53.951-11.884 53.951-11.587L53.951-10.033Q53.951-9.865 54.121-9.818Q54.291-9.771 54.561-9.771",[2711],[2696,3010,3011],{"transform":2922},[2279,3012],{"d":3013,"fill":2698,"stroke":2698,"className":3014,"style":2748},"M60.406-9.650Q60.410-9.669 60.412-9.683Q60.414-9.697 60.414-9.720L61.567-14.322Q61.606-14.509 61.606-14.537Q61.606-14.642 61.110-14.642Q61.012-14.673 61.012-14.771L61.035-14.872Q61.043-14.919 61.125-14.939L62.231-15.025Q62.281-15.025 62.315-14.995Q62.348-14.966 62.348-14.908L61.524-11.619Q61.817-11.747 62.266-12.173Q62.715-12.599 62.990-12.800Q63.266-13.001 63.645-13.001Q63.891-13.001 64.051-12.837Q64.211-12.673 64.211-12.427Q64.211-12.204 64.078-12.038Q63.945-11.872 63.735-11.872Q63.602-11.872 63.508-11.956Q63.414-12.040 63.414-12.177Q63.414-12.361 63.545-12.501Q63.676-12.642 63.860-12.642Q63.778-12.747 63.629-12.747Q63.403-12.747 63.164-12.615Q62.926-12.482 62.781-12.351Q62.637-12.220 62.305-11.910Q61.973-11.599 61.820-11.497Q63.020-11.365 63.020-10.642Q63.020-10.525 62.977-10.324Q62.934-10.122 62.934-10.033Q62.934-9.650 63.188-9.650Q63.469-9.650 63.625-9.954Q63.781-10.259 63.875-10.650Q63.910-10.720 63.965-10.720L64.070-10.720Q64.110-10.720 64.133-10.691Q64.156-10.662 64.156-10.626Q64.156-10.611 64.149-10.595Q64.039-10.122 63.799-9.759Q63.559-9.396 63.172-9.396Q62.817-9.396 62.574-9.624Q62.332-9.853 62.332-10.208Q62.332-10.279 62.356-10.415Q62.379-10.552 62.379-10.626Q62.379-10.837 62.231-10.974Q62.082-11.111 61.861-11.179Q61.641-11.247 61.438-11.267L61.035-9.665Q61.004-9.544 60.906-9.470Q60.809-9.396 60.684-9.396Q60.570-9.396 60.488-9.466Q60.406-9.537 60.406-9.650",[2711],[2696,3016,3017],{"transform":2922},[2279,3018],{"d":3019,"fill":2698,"stroke":2698,"className":3020,"style":2748},"M65.245-7.474L65.163-7.474Q65.127-7.474 65.102-7.503Q65.077-7.533 65.077-7.572Q65.077-7.622 65.108-7.642Q65.495-7.978 65.778-8.427Q66.061-8.876 66.227-9.376Q66.393-9.876 66.467-10.394Q66.541-10.912 66.541-11.474Q66.541-12.044 66.467-12.560Q66.393-13.076 66.227-13.572Q66.061-14.068 65.782-14.515Q65.502-14.962 65.108-15.306Q65.077-15.326 65.077-15.376Q65.077-15.415 65.102-15.445Q65.127-15.474 65.163-15.474L65.245-15.474Q65.256-15.474 65.266-15.472Q65.276-15.470 65.284-15.466Q65.897-15.009 66.299-14.374Q66.702-13.740 66.897-12.994Q67.092-12.247 67.092-11.474Q67.092-10.701 66.897-9.954Q66.702-9.208 66.299-8.574Q65.897-7.939 65.284-7.482Q65.272-7.482 65.264-7.480Q65.256-7.478 65.245-7.474",[2711],[3022,3023,3026,3027,3042,3043],"figcaption",{"className":3024},[3025],"tikz-cap","route through ",[444,3028,3030],{"className":3029},[447],[444,3031,3033],{"className":3032,"ariaHidden":452},[451],[444,3034,3036,3039],{"className":3035},[456],[444,3037],{"className":3038,"style":1295},[460],[444,3040,730],{"className":3041,"style":729},[465,466],", or don't — the Floyd–Warshall ",[444,3044,3046],{"className":3045},[447],[444,3047,3049],{"className":3048,"ariaHidden":452},[451],[444,3050,3052,3055],{"className":3051},[456],[444,3053],{"className":3054,"style":577},[460],[444,3056,3058],{"className":3057},[581],[444,3059,586],{"className":3060},[465,585],[381,3062,3063,3064,3116,3117,3179,3180,3195,3196,3229,3230,3263,3264,3283,3284,3299],{},"Because ",[444,3065,3067],{"className":3066},[447],[444,3068,3070],{"className":3069,"ariaHidden":452},[451],[444,3071,3073,3076],{"className":3072},[456],[444,3074],{"className":3075,"style":961},[460],[444,3077,3079,3082],{"className":3078},[465],[444,3080,692],{"className":3081},[465,466],[444,3083,3085],{"className":3084},[696],[444,3086,3088,3108],{"className":3087},[700,701],[444,3089,3091,3105],{"className":3090},[705],[444,3092,3094],{"className":3093,"style":710},[709],[444,3095,3096,3099],{"style":713},[444,3097],{"className":3098,"style":718},[717],[444,3100,3102],{"className":3101},[722,723,724,725],[444,3103,730],{"className":3104,"style":729},[465,466,725],[444,3106,735],{"className":3107},[734],[444,3109,3111],{"className":3110},[705],[444,3112,3114],{"className":3113,"style":742},[709],[444,3115],{}," depends only on ",[444,3118,3120],{"className":3119},[447],[444,3121,3123],{"className":3122,"ariaHidden":452},[451],[444,3124,3126,3130],{"className":3125},[456],[444,3127],{"className":3128,"style":3129},[460],"height:0.9028em;vertical-align:-0.2083em;",[444,3131,3133,3136],{"className":3132},[465],[444,3134,692],{"className":3135},[465,466],[444,3137,3139],{"className":3138},[696],[444,3140,3142,3171],{"className":3141},[700,701],[444,3143,3145,3168],{"className":3144},[705],[444,3146,3148],{"className":3147,"style":710},[709],[444,3149,3150,3153],{"style":713},[444,3151],{"className":3152,"style":718},[717],[444,3154,3156],{"className":3155},[722,723,724,725],[444,3157,3159,3162,3165],{"className":3158},[465,725],[444,3160,730],{"className":3161,"style":729},[465,466,725],[444,3163,1346],{"className":3164},[1345,725],[444,3166,609],{"className":3167},[465,725],[444,3169,735],{"className":3170},[734],[444,3172,3174],{"className":3173},[705],[444,3175,3177],{"className":3176,"style":2357},[709],[444,3178],{},", and the two cells it reads in row\u002Fcolumn\n",[444,3181,3183],{"className":3182},[447],[444,3184,3186],{"className":3185,"ariaHidden":452},[451],[444,3187,3189,3192],{"className":3188},[456],[444,3190],{"className":3191,"style":1295},[460],[444,3193,730],{"className":3194,"style":729},[465,466]," are unchanged when ",[444,3197,3199],{"className":3198},[447],[444,3200,3202,3220],{"className":3201,"ariaHidden":452},[451],[444,3203,3205,3208,3211,3214,3217],{"className":3204},[456],[444,3206],{"className":3207,"style":781},[460],[444,3209,752],{"className":3210},[465,466],[444,3212],{"className":3213,"style":1150},[519],[444,3215,1155],{"className":3216},[1154],[444,3218],{"className":3219,"style":1150},[519],[444,3221,3223,3226],{"className":3222},[456],[444,3224],{"className":3225,"style":1295},[460],[444,3227,730],{"className":3228,"style":729},[465,466]," or ",[444,3231,3233],{"className":3232},[447],[444,3234,3236,3254],{"className":3235,"ariaHidden":452},[451],[444,3237,3239,3242,3245,3248,3251],{"className":3238},[456],[444,3240],{"className":3241,"style":798},[460],[444,3243,764],{"className":3244,"style":763},[465,466],[444,3246],{"className":3247,"style":1150},[519],[444,3249,1155],{"className":3250},[1154],[444,3252],{"className":3253,"style":1150},[519],[444,3255,3257,3260],{"className":3256},[456],[444,3258],{"className":3259,"style":1295},[460],[444,3261,730],{"className":3262,"style":729},[465,466],", we can ",[389,3265,3266,3267,3282],{},"drop the ",[444,3268,3270],{"className":3269},[447],[444,3271,3273],{"className":3272,"ariaHidden":452},[451],[444,3274,3276,3279],{"className":3275},[456],[444,3277],{"className":3278,"style":1295},[460],[444,3280,730],{"className":3281,"style":729},[465,466]," index and update the\nmatrix in place",". This yields the entire algorithm in three nested loops with\n",[444,3285,3287],{"className":3286},[447],[444,3288,3290],{"className":3289,"ariaHidden":452},[451],[444,3291,3293,3296],{"className":3292},[456],[444,3294],{"className":3295,"style":1295},[460],[444,3297,730],{"className":3298,"style":729},[465,466]," outermost:",[3301,3302,3306],"pre",{"className":3303,"code":3304,"language":3305,"meta":376,"style":376},"language-algorithm shiki shiki-themes Vesper Light - Orange Boost (Quick Open Adjusted) vesper","caption: $\\textsc{Floyd-Warshall}(W)$ — all-pairs shortest paths in $O(V^3)$\n$d \\gets W$ \u002F\u002F $w(i,j)$; $0$ on diagonal, else $\\infty$\nfor $k \\gets 1$ to $V$ do\n  for $i \\gets 1$ to $V$ do\n    for $j \\gets 1$ to $V$ do\n      if $d[i][k] + d[k][j] \u003C d[i][j]$ then\n        $d[i][j] \\gets d[i][k] + d[k][j]$\n        $\\text{next}[i][j] \\gets \\text{next}[i][k]$ \u002F\u002F for reconstruction\nreturn $d$\n","algorithm",[3307,3308,3309,3315,3320,3325,3330,3335,3340,3345,3350],"code",{"__ignoreMap":376},[444,3310,3312],{"class":3311,"line":6},"line",[444,3313,3314],{},"caption: $\\textsc{Floyd-Warshall}(W)$ — all-pairs shortest paths in $O(V^3)$\n",[444,3316,3317],{"class":3311,"line":18},[444,3318,3319],{},"$d \\gets W$ \u002F\u002F $w(i,j)$; $0$ on diagonal, else $\\infty$\n",[444,3321,3322],{"class":3311,"line":24},[444,3323,3324],{},"for $k \\gets 1$ to $V$ do\n",[444,3326,3327],{"class":3311,"line":73},[444,3328,3329],{},"  for $i \\gets 1$ to $V$ do\n",[444,3331,3332],{"class":3311,"line":102},[444,3333,3334],{},"    for $j \\gets 1$ to $V$ do\n",[444,3336,3337],{"class":3311,"line":108},[444,3338,3339],{},"      if $d[i][k] + d[k][j] \u003C d[i][j]$ then\n",[444,3341,3342],{"class":3311,"line":116},[444,3343,3344],{},"        $d[i][j] \\gets d[i][k] + d[k][j]$\n",[444,3346,3347],{"class":3311,"line":196},[444,3348,3349],{},"        $\\text{next}[i][j] \\gets \\text{next}[i][k]$ \u002F\u002F for reconstruction\n",[444,3351,3352],{"class":3311,"line":202},[444,3353,3354],{},"return $d$\n",[381,3356,3357,3358,3413,3414,3464,3465,3468,3469,3472,3473],{},"The triple loop is ",[444,3359,3361],{"className":3360},[447],[444,3362,3364],{"className":3363,"ariaHidden":452},[451],[444,3365,3367,3371,3375,3378,3410],{"className":3366},[456],[444,3368],{"className":3369,"style":3370},[460],"height:1.0641em;vertical-align:-0.25em;",[444,3372,3374],{"className":3373},[465],"Θ",[444,3376,506],{"className":3377},[505],[444,3379,3381,3384],{"className":3380},[465],[444,3382,658],{"className":3383,"style":657},[465,466],[444,3385,3387],{"className":3386},[696],[444,3388,3390],{"className":3389},[700],[444,3391,3393],{"className":3392},[705],[444,3394,3397],{"className":3395,"style":3396},[709],"height:0.8141em;",[444,3398,3400,3403],{"style":3399},"top:-3.063em;margin-right:0.05em;",[444,3401],{"className":3402,"style":718},[717],[444,3404,3406],{"className":3405},[722,723,724,725],[444,3407,3409],{"className":3408},[465,725],"3",[444,3411,530],{"className":3412},[529]," time and ",[444,3415,3417],{"className":3416},[447],[444,3418,3420],{"className":3419,"ariaHidden":452},[451],[444,3421,3423,3426,3429,3432,3461],{"className":3422},[456],[444,3424],{"className":3425,"style":3370},[460],[444,3427,3374],{"className":3428},[465],[444,3430,506],{"className":3431},[505],[444,3433,3435,3438],{"className":3434},[465],[444,3436,658],{"className":3437,"style":657},[465,466],[444,3439,3441],{"className":3440},[696],[444,3442,3444],{"className":3443},[700],[444,3445,3447],{"className":3446},[705],[444,3448,3450],{"className":3449,"style":3396},[709],[444,3451,3452,3455],{"style":3399},[444,3453],{"className":3454,"style":718},[717],[444,3456,3458],{"className":3457},[722,723,724,725],[444,3459,1794],{"className":3460},[465,725],[444,3462,530],{"className":3463},[529]," space, independent of the\nedge count, which is what makes Floyd–Warshall the method of choice for ",[389,3466,3467],{},"dense","\ngraphs where we want ",[397,3470,3471],{},"every"," pair at once.",[601,3474,3475],{},[385,3476,1794],{"href":3477,"ariaDescribedBy":3478,"dataFootnoteRef":376,"id":3479},"#user-content-fn-clrs-fw",[607],"user-content-fnref-clrs-fw",[665,3481,3483],{"type":3482},"remark",[381,3484,3485,3488,3489,3492,3493,3496,3497,3549,3550,3565],{},[389,3486,3487],{},"Remark (negative edges)."," The derivation never assumed non-negative weights,\nonly the ",[397,3490,3491],{},"absence of negative cycles"," (used to argue shortest paths are\nsimple). So Floyd–Warshall handles negative edges directly, unlike Dijkstra.\nAnd it ",[389,3494,3495],{},"detects"," a negative cycle for free: after the algorithm, a negative\ncycle exists iff ",[444,3498,3500],{"className":3499},[447],[444,3501,3503,3540],{"className":3502,"ariaHidden":452},[451],[444,3504,3506,3509,3512,3515,3518,3521,3524,3527,3530,3533,3537],{"className":3505},[456],[444,3507],{"className":3508,"style":501},[460],[444,3510,692],{"className":3511},[465,466],[444,3513,748],{"className":3514},[505],[444,3516,752],{"className":3517},[465,466],[444,3519,756],{"className":3520},[529],[444,3522,748],{"className":3523},[505],[444,3525,752],{"className":3526},[465,466],[444,3528,756],{"className":3529},[529],[444,3531],{"className":3532,"style":1150},[519],[444,3534,3536],{"className":3535},[1154],"\u003C",[444,3538],{"className":3539,"style":1150},[519],[444,3541,3543,3546],{"className":3542},[456],[444,3544],{"className":3545,"style":1127},[460],[444,3547,992],{"className":3548},[465]," for some ",[444,3551,3553],{"className":3552},[447],[444,3554,3556],{"className":3555,"ariaHidden":452},[451],[444,3557,3559,3562],{"className":3558},[456],[444,3560],{"className":3561,"style":781},[460],[444,3563,752],{"className":3564},[465,466],", meaning some vertex can reach\nitself at negative cost.",[381,3567,3568,3571,3572,3592,3593,3647,3648,3663,3664,3679,3680,3695,3696,3711,3712,3805,3806,3826,3827,3830,3831,3846,3847,3850],{},[389,3569,3570],{},"Path reconstruction"," uses a ",[444,3573,3575],{"className":3574},[447],[444,3576,3578],{"className":3577,"ariaHidden":452},[451],[444,3579,3581,3585],{"className":3580},[456],[444,3582],{"className":3583,"style":3584},[460],"height:0.6151em;",[444,3586,3588],{"className":3587},[465,2226],[444,3589,3591],{"className":3590},[465],"next"," matrix (above) initialized to\n",[444,3594,3596],{"className":3595},[447],[444,3597,3599,3638],{"className":3598,"ariaHidden":452},[451],[444,3600,3602,3605,3611,3614,3617,3620,3623,3626,3629,3632,3635],{"className":3601},[456],[444,3603],{"className":3604,"style":501},[460],[444,3606,3608],{"className":3607},[465,2226],[444,3609,3591],{"className":3610},[465],[444,3612,748],{"className":3613},[505],[444,3615,752],{"className":3616},[465,466],[444,3618,756],{"className":3619},[529],[444,3621,748],{"className":3622},[505],[444,3624,764],{"className":3625,"style":763},[465,466],[444,3627,756],{"className":3628},[529],[444,3630],{"className":3631,"style":1150},[519],[444,3633,1155],{"className":3634},[1154],[444,3636],{"className":3637,"style":1150},[519],[444,3639,3641,3644],{"className":3640},[456],[444,3642],{"className":3643,"style":798},[460],[444,3645,764],{"className":3646,"style":763},[465,466]," for each edge: whenever routing through ",[444,3649,3651],{"className":3650},[447],[444,3652,3654],{"className":3653,"ariaHidden":452},[451],[444,3655,3657,3660],{"className":3656},[456],[444,3658],{"className":3659,"style":1295},[460],[444,3661,730],{"className":3662,"style":729},[465,466]," wins, the first\nhop out of ",[444,3665,3667],{"className":3666},[447],[444,3668,3670],{"className":3669,"ariaHidden":452},[451],[444,3671,3673,3676],{"className":3672},[456],[444,3674],{"className":3675,"style":781},[460],[444,3677,752],{"className":3678},[465,466]," toward ",[444,3681,3683],{"className":3682},[447],[444,3684,3686],{"className":3685,"ariaHidden":452},[451],[444,3687,3689,3692],{"className":3688},[456],[444,3690],{"className":3691,"style":798},[460],[444,3693,764],{"className":3694,"style":763},[465,466]," becomes the first hop toward ",[444,3697,3699],{"className":3698},[447],[444,3700,3702],{"className":3701,"ariaHidden":452},[451],[444,3703,3705,3708],{"className":3704},[456],[444,3706],{"className":3707,"style":1295},[460],[444,3709,730],{"className":3710,"style":729},[465,466],". To rebuild a path,\nfollow ",[444,3713,3715],{"className":3714},[447],[444,3716,3718,3737,3776,3796],{"className":3717,"ariaHidden":452},[451],[444,3719,3721,3724,3727,3730,3734],{"className":3720},[456],[444,3722],{"className":3723,"style":781},[460],[444,3725,752],{"className":3726},[465,466],[444,3728],{"className":3729,"style":1150},[519],[444,3731,3733],{"className":3732},[1154],"→",[444,3735],{"className":3736,"style":1150},[519],[444,3738,3740,3743,3749,3752,3755,3758,3761,3764,3767,3770,3773],{"className":3739},[456],[444,3741],{"className":3742,"style":501},[460],[444,3744,3746],{"className":3745},[465,2226],[444,3747,3591],{"className":3748},[465],[444,3750,748],{"className":3751},[505],[444,3753,752],{"className":3754},[465,466],[444,3756,756],{"className":3757},[529],[444,3759,748],{"className":3760},[505],[444,3762,764],{"className":3763,"style":763},[465,466],[444,3765,756],{"className":3766},[529],[444,3768],{"className":3769,"style":1150},[519],[444,3771,3733],{"className":3772},[1154],[444,3774],{"className":3775,"style":1150},[519],[444,3777,3779,3783,3787,3790,3793],{"className":3778},[456],[444,3780],{"className":3781,"style":3782},[460],"height:0.3669em;",[444,3784,3786],{"className":3785},[643],"⋯",[444,3788],{"className":3789,"style":1150},[519],[444,3791,3733],{"className":3792},[1154],[444,3794],{"className":3795,"style":1150},[519],[444,3797,3799,3802],{"className":3798},[456],[444,3800],{"className":3801,"style":798},[460],[444,3803,764],{"className":3804,"style":763},[465,466],". (A ",[444,3807,3809],{"className":3808},[447],[444,3810,3812],{"className":3811,"ariaHidden":452},[451],[444,3813,3815,3819],{"className":3814},[456],[444,3816],{"className":3817,"style":3818},[460],"height:0.8889em;vertical-align:-0.1944em;",[444,3820,3822],{"className":3821},[465,2226],[444,3823,3825],{"className":3824},[465],"pred"," matrix storing\nthe ",[397,3828,3829],{},"last"," vertex before ",[444,3832,3834],{"className":3833},[447],[444,3835,3837],{"className":3836,"ariaHidden":452},[451],[444,3838,3840,3843],{"className":3839},[456],[444,3841],{"className":3842,"style":798},[460],[444,3844,764],{"className":3845,"style":763},[465,466]," is the symmetric alternative.) The practice problem\n",[397,3848,3849],{},"Find the City With the Smallest Number of Neighbors at a Threshold Distance"," is\nFloyd–Warshall verbatim: compute all-pairs distances, then count for each city\nhow many others lie within the threshold.",[611,3852,3854],{"id":3853},"bellmanford-edges-as-the-resource","Bellman–Ford: edges as the resource",[381,3856,3857,3858,3860],{},"Floyd–Warshall rations intermediate vertices. Bellman–Ford rations ",[389,3859,441],{},",\nwhich makes it a single-source DP over path length.",[665,3862,3863],{"type":667},[381,3864,3865,673,3867,3933,3934,785,3950,3965,3966,3985,3986,591,4065,4144],{},[389,3866,672],{},[444,3868,3870],{"className":3869},[447],[444,3871,3873],{"className":3872,"ariaHidden":452},[451],[444,3874,3876,3879,3924,3927,3930],{"className":3875},[456],[444,3877],{"className":3878,"style":501},[460],[444,3880,3882,3887],{"className":3881},[465],[444,3883,3886],{"className":3884,"style":3885},[465,466],"margin-right:0.0278em;","D",[444,3888,3890],{"className":3889},[696],[444,3891,3893,3916],{"className":3892},[700,701],[444,3894,3896,3913],{"className":3895},[705],[444,3897,3900],{"className":3898,"style":3899},[709],"height:0.2806em;",[444,3901,3903,3906],{"style":3902},"top:-2.55em;margin-left:-0.0278em;margin-right:0.05em;",[444,3904],{"className":3905,"style":718},[717],[444,3907,3909],{"className":3908},[722,723,724,725],[444,3910,3912],{"className":3911},[465,466,725],"t",[444,3914,735],{"className":3915},[734],[444,3917,3919],{"className":3918},[705],[444,3920,3922],{"className":3921,"style":742},[709],[444,3923],{},[444,3925,748],{"className":3926},[505],[444,3928,525],{"className":3929,"style":524},[465,466],[444,3931,756],{"className":3932},[529]," be the shortest distance from the source ",[444,3935,3937],{"className":3936},[447],[444,3938,3940],{"className":3939,"ariaHidden":452},[451],[444,3941,3943,3946],{"className":3942},[456],[444,3944],{"className":3945,"style":544},[460],[444,3947,3949],{"className":3948},[465,466],"s",[444,3951,3953],{"className":3952},[447],[444,3954,3956],{"className":3955,"ariaHidden":452},[451],[444,3957,3959,3962],{"className":3958},[456],[444,3960],{"className":3961,"style":544},[460],[444,3963,525],{"className":3964,"style":524},[465,466]," using a path of ",[389,3967,3968,3969,3984],{},"at most ",[444,3970,3972],{"className":3971},[447],[444,3973,3975],{"className":3974,"ariaHidden":452},[451],[444,3976,3978,3981],{"className":3977},[456],[444,3979],{"className":3980,"style":3584},[460],[444,3982,3912],{"className":3983},[465,466]," edges",". Then ",[444,3987,3989],{"className":3988},[447],[444,3990,3992,4056],{"className":3991,"ariaHidden":452},[451],[444,3993,3995,3998,4038,4041,4044,4047,4050,4053],{"className":3994},[456],[444,3996],{"className":3997,"style":501},[460],[444,3999,4001,4004],{"className":4000},[465],[444,4002,3886],{"className":4003,"style":3885},[465,466],[444,4005,4007],{"className":4006},[696],[444,4008,4010,4030],{"className":4009},[700,701],[444,4011,4013,4027],{"className":4012},[705],[444,4014,4016],{"className":4015,"style":980},[709],[444,4017,4018,4021],{"style":3902},[444,4019],{"className":4020,"style":718},[717],[444,4022,4024],{"className":4023},[722,723,724,725],[444,4025,992],{"className":4026},[465,725],[444,4028,735],{"className":4029},[734],[444,4031,4033],{"className":4032},[705],[444,4034,4036],{"className":4035,"style":742},[709],[444,4037],{},[444,4039,748],{"className":4040},[505],[444,4042,3949],{"className":4043},[465,466],[444,4045,756],{"className":4046},[529],[444,4048],{"className":4049,"style":1150},[519],[444,4051,1155],{"className":4052},[1154],[444,4054],{"className":4055,"style":1150},[519],[444,4057,4059,4062],{"className":4058},[456],[444,4060],{"className":4061,"style":1127},[460],[444,4063,992],{"className":4064},[465],[444,4066,4068],{"className":4067},[447],[444,4069,4071,4135],{"className":4070,"ariaHidden":452},[451],[444,4072,4074,4077,4117,4120,4123,4126,4129,4132],{"className":4073},[456],[444,4075],{"className":4076,"style":501},[460],[444,4078,4080,4083],{"className":4079},[465],[444,4081,3886],{"className":4082,"style":3885},[465,466],[444,4084,4086],{"className":4085},[696],[444,4087,4089,4109],{"className":4088},[700,701],[444,4090,4092,4106],{"className":4091},[705],[444,4093,4095],{"className":4094,"style":980},[709],[444,4096,4097,4100],{"style":3902},[444,4098],{"className":4099,"style":718},[717],[444,4101,4103],{"className":4102},[722,723,724,725],[444,4104,992],{"className":4105},[465,725],[444,4107,735],{"className":4108},[734],[444,4110,4112],{"className":4111},[705],[444,4113,4115],{"className":4114,"style":742},[709],[444,4116],{},[444,4118,748],{"className":4119},[505],[444,4121,525],{"className":4122,"style":524},[465,466],[444,4124,756],{"className":4125},[529],[444,4127],{"className":4128,"style":1150},[519],[444,4130,1155],{"className":4131},[1154],[444,4133],{"className":4134,"style":1150},[519],[444,4136,4138,4141],{"className":4137},[456],[444,4139],{"className":4140,"style":544},[460],[444,4142,1189],{"className":4143},[465],"\notherwise.",[381,4146,4147,4148,4163,4164,4179,4180,4214,4215,4230,4231,4246,4247,1721],{},"A walk of at most ",[444,4149,4151],{"className":4150},[447],[444,4152,4154],{"className":4153,"ariaHidden":452},[451],[444,4155,4157,4160],{"className":4156},[456],[444,4158],{"className":4159,"style":3584},[460],[444,4161,3912],{"className":4162},[465,466]," edges to ",[444,4165,4167],{"className":4166},[447],[444,4168,4170],{"className":4169,"ariaHidden":452},[451],[444,4171,4173,4176],{"className":4172},[456],[444,4174],{"className":4175,"style":544},[460],[444,4177,525],{"className":4178,"style":524},[465,466]," is either a walk of at most ",[444,4181,4183],{"className":4182},[447],[444,4184,4186,4205],{"className":4185,"ariaHidden":452},[451],[444,4187,4189,4193,4196,4199,4202],{"className":4188},[456],[444,4190],{"className":4191,"style":4192},[460],"height:0.6984em;vertical-align:-0.0833em;",[444,4194,3912],{"className":4195},[465,466],[444,4197],{"className":4198,"style":657},[519],[444,4200,1346],{"className":4201},[1345],[444,4203],{"className":4204,"style":657},[519],[444,4206,4208,4211],{"className":4207},[456],[444,4209],{"className":4210,"style":1127},[460],[444,4212,609],{"className":4213},[465]," edges to\n",[444,4216,4218],{"className":4217},[447],[444,4219,4221],{"className":4220,"ariaHidden":452},[451],[444,4222,4224,4227],{"className":4223},[456],[444,4225],{"className":4226,"style":544},[460],[444,4228,525],{"className":4229,"style":524},[465,466],", or such a walk to some predecessor ",[444,4232,4234],{"className":4233},[447],[444,4235,4237],{"className":4236,"ariaHidden":452},[451],[444,4238,4240,4243],{"className":4239},[456],[444,4241],{"className":4242,"style":544},[460],[444,4244,510],{"className":4245},[465,466]," followed by the edge ",[444,4248,4250],{"className":4249},[447],[444,4251,4253],{"className":4252,"ariaHidden":452},[451],[444,4254,4256,4259,4262,4265,4268,4271,4274],{"className":4255},[456],[444,4257],{"className":4258,"style":501},[460],[444,4260,506],{"className":4261},[505],[444,4263,510],{"className":4264},[465,466],[444,4266,515],{"className":4267},[514],[444,4269],{"className":4270,"style":520},[519],[444,4272,525],{"className":4273,"style":524},[465,466],[444,4275,530],{"className":4276},[529],[444,4278,4280],{"className":4279},[2086],[444,4281,4283],{"className":4282},[447],[444,4284,4286,4350,4580],{"className":4285,"ariaHidden":452},[451],[444,4287,4289,4292,4332,4335,4338,4341,4344,4347],{"className":4288},[456],[444,4290],{"className":4291,"style":501},[460],[444,4293,4295,4298],{"className":4294},[465],[444,4296,3886],{"className":4297,"style":3885},[465,466],[444,4299,4301],{"className":4300},[696],[444,4302,4304,4324],{"className":4303},[700,701],[444,4305,4307,4321],{"className":4306},[705],[444,4308,4310],{"className":4309,"style":3899},[709],[444,4311,4312,4315],{"style":3902},[444,4313],{"className":4314,"style":718},[717],[444,4316,4318],{"className":4317},[722,723,724,725],[444,4319,3912],{"className":4320},[465,466,725],[444,4322,735],{"className":4323},[734],[444,4325,4327],{"className":4326},[705],[444,4328,4330],{"className":4329,"style":742},[709],[444,4331],{},[444,4333,748],{"className":4334},[505],[444,4336,525],{"className":4337,"style":524},[465,466],[444,4339,756],{"className":4340},[529],[444,4342],{"className":4343,"style":1150},[519],[444,4345,1155],{"className":4346},[1154],[444,4348],{"className":4349,"style":1150},[519],[444,4351,4353,4357,4363,4366,4373,4422,4425,4428,4431,4434,4437,4440,4510,4513,4562,4565,4568,4571,4574,4577],{"className":4352},[456],[444,4354],{"className":4355,"style":4356},[460],"height:1.8em;vertical-align:-0.65em;",[444,4358,4360],{"className":4359},[581],[444,4361,586],{"className":4362},[465,585],[444,4364],{"className":4365,"style":520},[519],[444,4367,4369],{"className":4368},[465],[444,4370,506],{"className":4371},[2188,4372],"size2",[444,4374,4376,4379],{"className":4375},[465],[444,4377,3886],{"className":4378,"style":3885},[465,466],[444,4380,4382],{"className":4381},[696],[444,4383,4385,4414],{"className":4384},[700,701],[444,4386,4388,4411],{"className":4387},[705],[444,4389,4391],{"className":4390,"style":980},[709],[444,4392,4393,4396],{"style":3902},[444,4394],{"className":4395,"style":718},[717],[444,4397,4399],{"className":4398},[722,723,724,725],[444,4400,4402,4405,4408],{"className":4401},[465,725],[444,4403,3912],{"className":4404},[465,466,725],[444,4406,1346],{"className":4407},[1345,725],[444,4409,609],{"className":4410},[465,725],[444,4412,735],{"className":4413},[734],[444,4415,4417],{"className":4416},[705],[444,4418,4420],{"className":4419,"style":2357},[709],[444,4421],{},[444,4423,748],{"className":4424},[505],[444,4426,525],{"className":4427,"style":524},[465,466],[444,4429,756],{"className":4430},[529],[444,4432,515],{"className":4433},[514],[444,4435,2411],{"className":4436},[519],[444,4438],{"className":4439,"style":520},[519],[444,4441,4443,4449],{"className":4442},[581],[444,4444,4446],{"className":4445},[581],[444,4447,586],{"className":4448},[465,585],[444,4450,4452],{"className":4451},[696],[444,4453,4455,4501],{"className":4454},[700,701],[444,4456,4458,4498],{"className":4457},[705],[444,4459,4462],{"className":4460,"style":4461},[709],"height:0.3448em;",[444,4463,4465,4468],{"style":4464},"top:-2.5198em;margin-right:0.05em;",[444,4466],{"className":4467,"style":718},[717],[444,4469,4471],{"className":4470},[722,723,724,725],[444,4472,4474,4477,4480,4483,4486,4489,4493],{"className":4473},[465,725],[444,4475,506],{"className":4476},[505,725],[444,4478,510],{"className":4479},[465,466,725],[444,4481,515],{"className":4482},[514,725],[444,4484,525],{"className":4485,"style":524},[465,466,725],[444,4487,530],{"className":4488},[529,725],[444,4490,4492],{"className":4491},[1154,725],"∈",[444,4494,4497],{"className":4495,"style":4496},[465,466,725],"margin-right:0.0576em;","E",[444,4499,735],{"className":4500},[734],[444,4502,4504],{"className":4503},[705],[444,4505,4508],{"className":4506,"style":4507},[709],"height:0.3552em;",[444,4509],{},[444,4511],{"className":4512,"style":520},[519],[444,4514,4516,4519],{"className":4515},[465],[444,4517,3886],{"className":4518,"style":3885},[465,466],[444,4520,4522],{"className":4521},[696],[444,4523,4525,4554],{"className":4524},[700,701],[444,4526,4528,4551],{"className":4527},[705],[444,4529,4531],{"className":4530,"style":980},[709],[444,4532,4533,4536],{"style":3902},[444,4534],{"className":4535,"style":718},[717],[444,4537,4539],{"className":4538},[722,723,724,725],[444,4540,4542,4545,4548],{"className":4541},[465,725],[444,4543,3912],{"className":4544},[465,466,725],[444,4546,1346],{"className":4547},[1345,725],[444,4549,609],{"className":4550},[465,725],[444,4552,735],{"className":4553},[734],[444,4555,4557],{"className":4556},[705],[444,4558,4560],{"className":4559,"style":2357},[709],[444,4561],{},[444,4563,748],{"className":4564},[505],[444,4566,510],{"className":4567},[465,466],[444,4569,756],{"className":4570},[529],[444,4572],{"className":4573,"style":657},[519],[444,4575,1185],{"className":4576},[1345],[444,4578],{"className":4579,"style":657},[519],[444,4581,4583,4586,4589,4592,4595,4598,4601,4604,4607,4613],{"className":4582},[456],[444,4584],{"className":4585,"style":4356},[460],[444,4587,1095],{"className":4588,"style":1094},[465,466],[444,4590,506],{"className":4591},[505],[444,4593,510],{"className":4594},[465,466],[444,4596,515],{"className":4597},[514],[444,4599],{"className":4600,"style":520},[519],[444,4602,525],{"className":4603,"style":524},[465,466],[444,4605,530],{"className":4606},[529],[444,4608,4610],{"className":4609},[465],[444,4611,530],{"className":4612},[2188,4372],[444,4614,1511],{"className":4615},[465],[381,4617,4618,4619,4634,4635,4638,4639,4673,4674,4736,4737,4770,4771,4800,4801,4804,4805,4812,4813,4846,4847,4862,4863,1511],{},"Each round is one full sweep of edge relaxations, exactly the relaxation\nprimitive from the Shortest Paths lesson, now indexed by a layer ",[444,4620,4622],{"className":4621},[447],[444,4623,4625],{"className":4624,"ariaHidden":452},[451],[444,4626,4628,4631],{"className":4627},[456],[444,4629],{"className":4630,"style":3584},[460],[444,4632,3912],{"className":4633},[465,466],". Because a\nshortest path in a graph with no negative cycle is ",[389,4636,4637],{},"simple",", it uses at most\n",[444,4640,4642],{"className":4641},[447],[444,4643,4645,4664],{"className":4644,"ariaHidden":452},[451],[444,4646,4648,4652,4655,4658,4661],{"className":4647},[456],[444,4649],{"className":4650,"style":4651},[460],"height:0.7667em;vertical-align:-0.0833em;",[444,4653,658],{"className":4654,"style":657},[465,466],[444,4656],{"className":4657,"style":657},[519],[444,4659,1346],{"className":4660},[1345],[444,4662],{"className":4663,"style":657},[519],[444,4665,4667,4670],{"className":4666},[456],[444,4668],{"className":4669,"style":1127},[460],[444,4671,609],{"className":4672},[465]," edges, so ",[444,4675,4677],{"className":4676},[447],[444,4678,4680],{"className":4679,"ariaHidden":452},[451],[444,4681,4683,4687],{"className":4682},[456],[444,4684],{"className":4685,"style":4686},[460],"height:0.8917em;vertical-align:-0.2083em;",[444,4688,4690,4693],{"className":4689},[465],[444,4691,3886],{"className":4692,"style":3885},[465,466],[444,4694,4696],{"className":4695},[696],[444,4697,4699,4728],{"className":4698},[700,701],[444,4700,4702,4725],{"className":4701},[705],[444,4703,4705],{"className":4704,"style":907},[709],[444,4706,4707,4710],{"style":3902},[444,4708],{"className":4709,"style":718},[717],[444,4711,4713],{"className":4712},[722,723,724,725],[444,4714,4716,4719,4722],{"className":4715},[465,725],[444,4717,658],{"className":4718,"style":657},[465,466,725],[444,4720,1346],{"className":4721},[1345,725],[444,4723,609],{"className":4724},[465,725],[444,4726,735],{"className":4727},[734],[444,4729,4731],{"className":4730},[705],[444,4732,4734],{"className":4733,"style":2357},[709],[444,4735],{}," is the answer: after ",[444,4738,4740],{"className":4739},[447],[444,4741,4743,4761],{"className":4742,"ariaHidden":452},[451],[444,4744,4746,4749,4752,4755,4758],{"className":4745},[456],[444,4747],{"className":4748,"style":4651},[460],[444,4750,658],{"className":4751,"style":657},[465,466],[444,4753],{"className":4754,"style":657},[519],[444,4756,1346],{"className":4757},[1345],[444,4759],{"className":4760,"style":657},[519],[444,4762,4764,4767],{"className":4763},[456],[444,4765],{"className":4766,"style":1127},[460],[444,4768,609],{"className":4769},[465]," rounds the table converges.\nIf one more round still relaxes some edge, a path of ",[444,4772,4774],{"className":4773},[447],[444,4775,4777,4791],{"className":4776,"ariaHidden":452},[451],[444,4778,4780,4784,4788],{"className":4779},[456],[444,4781],{"className":4782,"style":4783},[460],"height:0.7719em;vertical-align:-0.136em;",[444,4785,4787],{"className":4786},[1154],"≥",[444,4789],{"className":4790,"style":1150},[519],[444,4792,4794,4797],{"className":4793},[456],[444,4795],{"className":4796,"style":461},[460],[444,4798,658],{"className":4799,"style":657},[465,466]," edges beats every\nshorter one, which can only happen along a ",[389,4802,4803],{},"negative cycle",", so that extra\nrelaxation is the standard negative-cycle test.",[601,4806,4807],{},[385,4808,3409],{"href":4809,"ariaDescribedBy":4810,"dataFootnoteRef":376,"id":4811},"#user-content-fn-clrs-bf",[607],"user-content-fnref-clrs-bf"," The cost is ",[444,4814,4816],{"className":4815},[447],[444,4817,4819,4837],{"className":4818,"ariaHidden":452},[451],[444,4820,4822,4825,4828,4831,4834],{"className":4821},[456],[444,4823],{"className":4824,"style":4651},[460],[444,4826,658],{"className":4827,"style":657},[465,466],[444,4829],{"className":4830,"style":657},[519],[444,4832,1346],{"className":4833},[1345],[444,4835],{"className":4836,"style":657},[519],[444,4838,4840,4843],{"className":4839},[456],[444,4841],{"className":4842,"style":1127},[460],[444,4844,609],{"className":4845},[465],"\nsweeps of ",[444,4848,4850],{"className":4849},[447],[444,4851,4853],{"className":4852,"ariaHidden":452},[451],[444,4854,4856,4859],{"className":4855},[456],[444,4857],{"className":4858,"style":461},[460],[444,4860,4497],{"className":4861,"style":4496},[465,466]," edges, ",[444,4864,4866],{"className":4865},[447],[444,4867,4869],{"className":4868,"ariaHidden":452},[451],[444,4870,4872,4875,4879,4882,4885,4888],{"className":4871},[456],[444,4873],{"className":4874,"style":501},[460],[444,4876,4878],{"className":4877,"style":3885},[465,466],"O",[444,4880,506],{"className":4881},[505],[444,4883,658],{"className":4884,"style":657},[465,466],[444,4886,4497],{"className":4887,"style":4496},[465,466],[444,4889,530],{"className":4890},[529],[381,4892,4893,4894,4897,4898,4901,4902,4935,4936,4951,4952,4985,4986,5056,5057,5090],{},"The layered view pays off directly when the problem ",[389,4895,4896],{},"caps the number of\nedges",". ",[397,4899,4900],{},"Cheapest Flights Within K Stops"," asks for the cheapest ",[444,4903,4905],{"className":4904},[447],[444,4906,4908,4926],{"className":4907,"ariaHidden":452},[451],[444,4909,4911,4914,4917,4920,4923],{"className":4910},[456],[444,4912],{"className":4913,"style":544},[460],[444,4915,3949],{"className":4916},[465,466],[444,4918],{"className":4919,"style":1150},[519],[444,4921,3733],{"className":4922},[1154],[444,4924],{"className":4925,"style":1150},[519],[444,4927,4929,4932],{"className":4928},[456],[444,4930],{"className":4931,"style":3584},[460],[444,4933,3912],{"className":4934},[465,466]," route\nusing at most ",[444,4937,4939],{"className":4938},[447],[444,4940,4942],{"className":4941,"ariaHidden":452},[451],[444,4943,4945,4948],{"className":4944},[456],[444,4946],{"className":4947,"style":461},[460],[444,4949,468],{"className":4950,"style":467},[465,466]," stops, i.e. at most ",[444,4953,4955],{"className":4954},[447],[444,4956,4958,4976],{"className":4957,"ariaHidden":452},[451],[444,4959,4961,4964,4967,4970,4973],{"className":4960},[456],[444,4962],{"className":4963,"style":4651},[460],[444,4965,468],{"className":4966,"style":467},[465,466],[444,4968],{"className":4969,"style":657},[519],[444,4971,1185],{"className":4972},[1345],[444,4974],{"className":4975,"style":657},[519],[444,4977,4979,4982],{"className":4978},[456],[444,4980],{"className":4981,"style":1127},[460],[444,4983,609],{"className":4984},[465]," edges. That is precisely ",[444,4987,4989],{"className":4988},[447],[444,4990,4992],{"className":4991,"ariaHidden":452},[451],[444,4993,4995,4998,5047,5050,5053],{"className":4994},[456],[444,4996],{"className":4997,"style":501},[460],[444,4999,5001,5004],{"className":5000},[465],[444,5002,3886],{"className":5003,"style":3885},[465,466],[444,5005,5007],{"className":5006},[696],[444,5008,5010,5039],{"className":5009},[700,701],[444,5011,5013,5036],{"className":5012},[705],[444,5014,5016],{"className":5015,"style":907},[709],[444,5017,5018,5021],{"style":3902},[444,5019],{"className":5020,"style":718},[717],[444,5022,5024],{"className":5023},[722,723,724,725],[444,5025,5027,5030,5033],{"className":5026},[465,725],[444,5028,468],{"className":5029,"style":467},[465,466,725],[444,5031,1185],{"className":5032},[1345,725],[444,5034,609],{"className":5035},[465,725],[444,5037,735],{"className":5038},[734],[444,5040,5042],{"className":5041},[705],[444,5043,5045],{"className":5044,"style":2357},[709],[444,5046],{},[444,5048,748],{"className":5049},[505],[444,5051,3912],{"className":5052},[465,466],[444,5054,756],{"className":5055},[529],":\nrun exactly ",[444,5058,5060],{"className":5059},[447],[444,5061,5063,5081],{"className":5062,"ariaHidden":452},[451],[444,5064,5066,5069,5072,5075,5078],{"className":5065},[456],[444,5067],{"className":5068,"style":4651},[460],[444,5070,468],{"className":5071,"style":467},[465,466],[444,5073],{"className":5074,"style":657},[519],[444,5076,1185],{"className":5077},[1345],[444,5079],{"className":5080,"style":657},[519],[444,5082,5084,5087],{"className":5083},[456],[444,5085],{"className":5086,"style":1127},[460],[444,5088,609],{"className":5089},[465]," Bellman–Ford rounds, no more.",[2685,5092,5094,5454],{"className":5093},[2688,2689],[2271,5095,5099],{"xmlns":2273,"width":5096,"height":5097,"viewBox":5098},"309.280","141.606","-75 -75 231.960 106.205",[2696,5100,5101,5108,5115,5122,5129,5150,5169,5188,5207,5210,5217,5220,5227,5230,5236,5239,5245,5248,5254,5257,5264,5267,5274,5277,5283,5286,5292,5295,5301,5314,5317,5324,5327,5333,5336,5342,5345,5351,5362,5408],{"stroke":2698,"style":2699},[2696,5102,5104],{"transform":5103},"translate(37.868 -18.195)",[2279,5105],{"d":5106,"fill":2698,"stroke":2698,"className":5107,"style":2748},"M-65.893-46.722Q-65.678-46.418-65.014-46.418Q-64.584-46.418-64.227-46.619Q-63.870-46.820-63.870-47.219Q-63.870-47.422-64.030-47.545Q-64.190-47.668-64.397-47.707L-64.862-47.793Q-65.178-47.863-65.393-48.070Q-65.608-48.277-65.608-48.586Q-65.608-48.949-65.403-49.221Q-65.198-49.492-64.868-49.631Q-64.538-49.769-64.182-49.769Q-63.795-49.769-63.485-49.601Q-63.174-49.433-63.174-49.082Q-63.174-48.890-63.280-48.750Q-63.385-48.609-63.573-48.609Q-63.682-48.609-63.764-48.681Q-63.846-48.754-63.846-48.867Q-63.846-49.012-63.749-49.121Q-63.651-49.230-63.510-49.250Q-63.600-49.394-63.791-49.455Q-63.983-49.515-64.198-49.515Q-64.530-49.515-64.803-49.344Q-65.077-49.172-65.077-48.859Q-65.077-48.703-64.965-48.609Q-64.854-48.515-64.678-48.472L-64.221-48.387Q-63.846-48.316-63.594-48.084Q-63.342-47.851-63.342-47.488Q-63.342-47.215-63.487-46.947Q-63.631-46.679-63.870-46.500Q-64.346-46.164-65.030-46.164Q-65.307-46.164-65.588-46.236Q-65.870-46.308-66.061-46.482Q-66.252-46.656-66.252-46.937Q-66.252-47.160-66.124-47.324Q-65.995-47.488-65.776-47.488Q-65.631-47.488-65.543-47.406Q-65.456-47.324-65.456-47.187Q-65.456-47.008-65.586-46.865Q-65.717-46.722-65.893-46.722",[2711],[2696,5109,5111],{"transform":5110},"translate(66.029 -18.195)",[2279,5112],{"d":5113,"fill":2698,"stroke":2698,"className":5114,"style":2748},"M-65.182-46.164Q-65.538-46.164-65.807-46.344Q-66.077-46.523-66.217-46.818Q-66.358-47.113-66.358-47.472Q-66.358-47.859-66.196-48.273Q-66.034-48.687-65.750-49.025Q-65.467-49.363-65.098-49.566Q-64.729-49.769-64.327-49.769Q-63.834-49.769-63.557-49.320Q-63.526-49.453-63.422-49.535Q-63.319-49.617-63.190-49.617Q-63.077-49.617-62.997-49.547Q-62.916-49.476-62.916-49.363Q-62.916-49.336-62.932-49.273L-63.487-47.074Q-63.526-46.828-63.526-46.777Q-63.526-46.418-63.280-46.418Q-63.135-46.418-63.034-46.525Q-62.932-46.633-62.868-46.787Q-62.803-46.941-62.754-47.131Q-62.706-47.320-62.686-47.418Q-62.659-47.488-62.596-47.488L-62.495-47.488Q-62.456-47.488-62.430-47.455Q-62.405-47.422-62.405-47.394Q-62.405-47.379-62.413-47.363Q-62.526-46.871-62.725-46.517Q-62.924-46.164-63.295-46.164Q-63.577-46.164-63.803-46.306Q-64.030-46.449-64.112-46.707Q-64.334-46.465-64.608-46.314Q-64.881-46.164-65.182-46.164M-65.166-46.418Q-64.956-46.418-64.747-46.531Q-64.538-46.644-64.368-46.818Q-64.198-46.992-64.069-47.187Q-64.081-47.172-64.090-47.158Q-64.100-47.144-64.112-47.129L-63.678-48.851Q-63.717-49.031-63.803-49.181Q-63.889-49.332-64.026-49.424Q-64.163-49.515-64.342-49.515Q-64.678-49.515-64.950-49.234Q-65.221-48.953-65.381-48.578Q-65.506-48.258-65.604-47.838Q-65.702-47.418-65.702-47.137Q-65.702-46.847-65.569-46.633Q-65.436-46.418-65.166-46.418",[2711],[2696,5116,5118],{"transform":5117},"translate(94.921 -17.14)",[2279,5119],{"d":5120,"fill":2698,"stroke":2698,"className":5121,"style":2748},"M-65.182-46.164Q-65.522-46.164-65.782-46.342Q-66.041-46.519-66.176-46.814Q-66.311-47.109-66.311-47.457Q-66.311-47.719-66.245-47.976L-65.495-51.004Q-65.483-51.051-65.456-51.152Q-65.428-51.254-65.428-51.304Q-65.428-51.410-65.924-51.410Q-66.022-51.441-66.022-51.539L-65.999-51.640Q-65.991-51.687-65.909-51.707L-64.807-51.793Q-64.764-51.793-64.725-51.762Q-64.686-51.730-64.686-51.676L-65.260-49.355Q-64.803-49.769-64.327-49.769Q-63.963-49.769-63.698-49.590Q-63.432-49.410-63.291-49.109Q-63.151-48.808-63.151-48.457Q-63.151-47.933-63.432-47.394Q-63.713-46.855-64.180-46.510Q-64.647-46.164-65.182-46.164M-65.166-46.418Q-64.831-46.418-64.551-46.709Q-64.272-47-64.135-47.355Q-64.010-47.648-63.909-48.082Q-63.807-48.515-63.807-48.793Q-63.807-49.078-63.940-49.297Q-64.073-49.515-64.342-49.515Q-64.553-49.515-64.749-49.414Q-64.944-49.312-65.104-49.156Q-65.264-49-65.397-48.808L-65.624-47.937Q-65.674-47.703-65.704-47.521Q-65.733-47.340-65.733-47.187Q-65.733-46.887-65.592-46.652Q-65.452-46.418-65.166-46.418",[2711],[2696,5123,5125],{"transform":5124},"translate(123.657 -17.457)",[2279,5126],{"d":5127,"fill":2698,"stroke":2698,"className":5128,"style":2748},"M-66.135-46.914Q-66.135-47.023-66.112-47.129L-65.541-49.394L-66.389-49.394Q-66.495-49.422-66.495-49.523L-66.471-49.625Q-66.452-49.676-66.374-49.691L-65.471-49.691L-65.151-50.953Q-65.124-51.082-65.018-51.162Q-64.913-51.242-64.784-51.242Q-64.674-51.242-64.596-51.168Q-64.518-51.094-64.518-50.984Q-64.518-50.937-64.526-50.914L-64.831-49.691L-63.983-49.691Q-63.885-49.660-63.885-49.570L-63.909-49.465Q-63.916-49.414-63.999-49.394L-64.901-49.394L-65.487-47.074Q-65.526-46.828-65.526-46.777Q-65.526-46.418-65.280-46.418Q-64.916-46.418-64.639-46.734Q-64.362-47.051-64.213-47.441Q-64.182-47.488-64.135-47.488L-64.030-47.488Q-63.991-47.488-63.967-47.459Q-63.944-47.429-63.944-47.394Q-63.944-47.379-63.952-47.363Q-64.135-46.879-64.489-46.521Q-64.842-46.164-65.295-46.164Q-65.639-46.164-65.887-46.371Q-66.135-46.578-66.135-46.914",[2711],[2696,5130,5132,5138,5144],{"stroke":2702,"fontSize":5131},"8",[2696,5133,5135],{"transform":5134},"translate(4.416 2.578)",[2279,5136],{"d":5127,"fill":2698,"stroke":2698,"className":5137,"style":2748},[2711],[2696,5139,5140],{"transform":5134},[2279,5141],{"d":5142,"fill":2698,"stroke":2698,"className":5143,"style":2748},"M-57.655-47.219L-62.968-47.219Q-63.046-47.226-63.095-47.275Q-63.143-47.324-63.143-47.402Q-63.143-47.472-63.096-47.523Q-63.050-47.574-62.968-47.586L-57.655-47.586Q-57.581-47.574-57.534-47.523Q-57.487-47.472-57.487-47.402Q-57.487-47.324-57.536-47.275Q-57.585-47.226-57.655-47.219M-57.655-48.906L-62.968-48.906Q-63.046-48.914-63.095-48.963Q-63.143-49.012-63.143-49.090Q-63.143-49.160-63.096-49.211Q-63.050-49.262-62.968-49.273L-57.655-49.273Q-57.581-49.262-57.534-49.211Q-57.487-49.160-57.487-49.090Q-57.487-49.012-57.536-48.963Q-57.585-48.914-57.655-48.906",[2711],[2696,5145,5146],{"transform":5134},[2279,5147],{"d":5148,"fill":2698,"stroke":2698,"className":5149,"style":2748},"M-54.884-46.074Q-55.587-46.074-55.987-46.474Q-56.388-46.875-56.532-47.484Q-56.677-48.094-56.677-48.793Q-56.677-49.316-56.607-49.779Q-56.536-50.242-56.343-50.654Q-56.150-51.066-55.792-51.314Q-55.435-51.562-54.884-51.562Q-54.333-51.562-53.976-51.314Q-53.618-51.066-53.427-50.656Q-53.235-50.246-53.165-49.777Q-53.095-49.308-53.095-48.793Q-53.095-48.094-53.237-47.486Q-53.380-46.879-53.780-46.476Q-54.181-46.074-54.884-46.074M-54.884-46.332Q-54.411-46.332-54.179-46.767Q-53.946-47.203-53.892-47.742Q-53.837-48.281-53.837-48.922Q-53.837-49.918-54.021-50.611Q-54.204-51.304-54.884-51.304Q-55.251-51.304-55.472-51.066Q-55.693-50.828-55.788-50.471Q-55.884-50.113-55.909-49.742Q-55.935-49.371-55.935-48.922Q-55.935-48.281-55.880-47.742Q-55.825-47.203-55.593-46.767Q-55.360-46.332-54.884-46.332",[2711],[2696,5151,5152,5158,5163],{"stroke":2702,"fontSize":5131},[2696,5153,5155],{"transform":5154},"translate(4.416 23.917)",[2279,5156],{"d":5127,"fill":2698,"stroke":2698,"className":5157,"style":2748},[2711],[2696,5159,5160],{"transform":5154},[2279,5161],{"d":5142,"fill":2698,"stroke":2698,"className":5162,"style":2748},[2711],[2696,5164,5165],{"transform":5154},[2279,5166],{"d":5167,"fill":2698,"stroke":2698,"className":5168,"style":2748},"M-53.411-46.242L-56.204-46.242L-56.204-46.539Q-55.142-46.539-55.142-46.801L-55.142-50.969Q-55.571-50.754-56.251-50.754L-56.251-51.051Q-55.232-51.051-54.716-51.562L-54.571-51.562Q-54.497-51.543-54.478-51.465L-54.478-46.801Q-54.478-46.539-53.411-46.539",[2711],[2696,5170,5171,5177,5182],{"stroke":2702,"fontSize":5131},[2696,5172,5174],{"transform":5173},"translate(4.416 45.257)",[2279,5175],{"d":5127,"fill":2698,"stroke":2698,"className":5176,"style":2748},[2711],[2696,5178,5179],{"transform":5173},[2279,5180],{"d":5142,"fill":2698,"stroke":2698,"className":5181,"style":2748},[2711],[2696,5183,5184],{"transform":5173},[2279,5185],{"d":5186,"fill":2698,"stroke":2698,"className":5187,"style":2748},"M-53.419-46.242L-56.579-46.242L-56.579-46.449Q-56.579-46.476-56.556-46.508L-55.204-47.906Q-54.825-48.293-54.577-48.582Q-54.329-48.871-54.155-49.228Q-53.982-49.586-53.982-49.976Q-53.982-50.324-54.114-50.617Q-54.247-50.910-54.501-51.088Q-54.755-51.265-55.110-51.265Q-55.470-51.265-55.761-51.070Q-56.052-50.875-56.196-50.547L-56.142-50.547Q-55.958-50.547-55.833-50.426Q-55.708-50.304-55.708-50.113Q-55.708-49.933-55.833-49.804Q-55.958-49.676-56.142-49.676Q-56.321-49.676-56.450-49.804Q-56.579-49.933-56.579-50.113Q-56.579-50.515-56.359-50.851Q-56.138-51.187-55.773-51.375Q-55.407-51.562-55.005-51.562Q-54.525-51.562-54.109-51.375Q-53.693-51.187-53.441-50.826Q-53.189-50.465-53.189-49.976Q-53.189-49.617-53.343-49.314Q-53.497-49.012-53.749-48.752Q-54.001-48.492-54.351-48.207Q-54.700-47.922-54.868-47.769L-55.798-46.929L-55.083-46.929Q-53.708-46.929-53.669-46.969Q-53.599-47.047-53.556-47.232Q-53.513-47.418-53.470-47.707L-53.189-47.707",[2711],[2696,5189,5190,5196,5201],{"stroke":2702,"fontSize":5131},[2696,5191,5193],{"transform":5192},"translate(4.416 66.596)",[2279,5194],{"d":5127,"fill":2698,"stroke":2698,"className":5195,"style":2748},[2711],[2696,5197,5198],{"transform":5192},[2279,5199],{"d":5142,"fill":2698,"stroke":2698,"className":5200,"style":2748},[2711],[2696,5202,5203],{"transform":5192},[2279,5204],{"d":5205,"fill":2698,"stroke":2698,"className":5206,"style":2748},"M-56.212-46.875Q-56.021-46.601-55.665-46.474Q-55.310-46.347-54.927-46.347Q-54.591-46.347-54.382-46.533Q-54.173-46.719-54.077-47.012Q-53.982-47.304-53.982-47.617Q-53.982-47.941-54.079-48.236Q-54.177-48.531-54.390-48.715Q-54.603-48.898-54.935-48.898L-55.501-48.898Q-55.532-48.898-55.562-48.928Q-55.591-48.957-55.591-48.984L-55.591-49.066Q-55.591-49.101-55.562-49.127Q-55.532-49.152-55.501-49.152L-55.021-49.187Q-54.735-49.187-54.538-49.392Q-54.341-49.597-54.245-49.892Q-54.150-50.187-54.150-50.465Q-54.150-50.844-54.349-51.082Q-54.548-51.320-54.927-51.320Q-55.247-51.320-55.536-51.213Q-55.825-51.105-55.989-50.883Q-55.810-50.883-55.687-50.756Q-55.564-50.629-55.564-50.457Q-55.564-50.285-55.689-50.160Q-55.814-50.035-55.989-50.035Q-56.161-50.035-56.286-50.160Q-56.411-50.285-56.411-50.457Q-56.411-50.824-56.187-51.072Q-55.962-51.320-55.622-51.441Q-55.282-51.562-54.927-51.562Q-54.579-51.562-54.216-51.441Q-53.853-51.320-53.605-51.070Q-53.357-50.820-53.357-50.465Q-53.357-49.980-53.675-49.597Q-53.993-49.215-54.470-49.043Q-53.919-48.933-53.519-48.547Q-53.118-48.160-53.118-47.625Q-53.118-47.168-53.382-46.812Q-53.646-46.457-54.068-46.265Q-54.489-46.074-54.927-46.074Q-55.337-46.074-55.730-46.209Q-56.122-46.344-56.388-46.629Q-56.653-46.914-56.653-47.332Q-56.653-47.527-56.521-47.656Q-56.388-47.785-56.196-47.785Q-56.071-47.785-55.968-47.726Q-55.864-47.668-55.802-47.562Q-55.739-47.457-55.739-47.332Q-55.739-47.137-55.874-47.006Q-56.009-46.875-56.212-46.875",[2711],[2279,5208],{"fill":2702,"d":5209},"M-39.656-36.284h25.607v-19.917h-25.607Z",[2696,5211,5213],{"transform":5212},"translate(37.709 2.578)",[2279,5214],{"d":5215,"fill":2698,"stroke":2698,"className":5216,"style":2748},"M-64.565-46.074Q-65.268-46.074-65.668-46.474Q-66.069-46.875-66.213-47.484Q-66.358-48.094-66.358-48.793Q-66.358-49.316-66.288-49.779Q-66.217-50.242-66.024-50.654Q-65.831-51.066-65.473-51.314Q-65.116-51.562-64.565-51.562Q-64.014-51.562-63.657-51.314Q-63.299-51.066-63.108-50.656Q-62.916-50.246-62.846-49.777Q-62.776-49.308-62.776-48.793Q-62.776-48.094-62.918-47.486Q-63.061-46.879-63.461-46.476Q-63.862-46.074-64.565-46.074M-64.565-46.332Q-64.092-46.332-63.860-46.767Q-63.627-47.203-63.573-47.742Q-63.518-48.281-63.518-48.922Q-63.518-49.918-63.702-50.611Q-63.885-51.304-64.565-51.304Q-64.932-51.304-65.153-51.066Q-65.374-50.828-65.469-50.471Q-65.565-50.113-65.590-49.742Q-65.616-49.371-65.616-48.922Q-65.616-48.281-65.561-47.742Q-65.506-47.203-65.274-46.767Q-65.041-46.332-64.565-46.332",[2711],[2279,5218],{"fill":2702,"d":5219},"M-11.203-36.284h25.607v-19.917h-25.607Z",[2696,5221,5223],{"transform":5222},"translate(64.036 1.722)",[2279,5224],{"d":5225,"fill":2698,"stroke":2698,"className":5226,"style":2748},"M-64.588-46.164Q-64.940-46.164-65.239-46.310Q-65.538-46.457-65.756-46.717Q-65.975-46.976-66.094-47.304Q-66.213-47.633-66.213-47.969Q-66.213-48.433-66.002-48.846Q-65.791-49.258-65.413-49.513Q-65.034-49.769-64.565-49.769Q-64.006-49.769-63.502-49.500Q-62.999-49.230-62.631-48.777L-62.374-48.457Q-62.116-48.836-61.801-49.127Q-61.487-49.418-61.102-49.594Q-60.717-49.769-60.288-49.769Q-59.936-49.769-59.631-49.619Q-59.327-49.469-59.114-49.219Q-58.901-48.969-58.782-48.644Q-58.663-48.320-58.663-47.969Q-58.663-47.504-58.875-47.088Q-59.088-46.672-59.465-46.418Q-59.842-46.164-60.311-46.164Q-60.858-46.164-61.366-46.431Q-61.874-46.699-62.245-47.152L-62.502-47.472Q-62.897-46.894-63.432-46.529Q-63.967-46.164-64.588-46.164M-64.670-46.488Q-64.092-46.488-63.606-46.861Q-63.120-47.234-62.764-47.793L-63.190-48.304Q-63.409-48.578-63.629-48.797Q-63.850-49.015-64.122-49.160Q-64.393-49.304-64.694-49.304Q-65.041-49.304-65.332-49.119Q-65.624-48.933-65.791-48.625Q-65.959-48.316-65.959-47.961Q-65.959-47.590-65.797-47.250Q-65.635-46.910-65.342-46.699Q-65.049-46.488-64.670-46.488M-62.112-48.137L-61.686-47.625Q-61.307-47.164-60.959-46.894Q-60.612-46.625-60.182-46.625Q-59.834-46.625-59.543-46.812Q-59.252-47-59.084-47.306Q-58.916-47.613-58.916-47.969Q-58.916-48.344-59.079-48.681Q-59.241-49.019-59.534-49.230Q-59.827-49.441-60.206-49.441Q-60.784-49.441-61.260-49.078Q-61.737-48.715-62.112-48.137",[2711],[2279,5228],{"fill":2702,"d":5229},"M17.25-36.284h25.607v-19.917H17.25Z",[2696,5231,5233],{"transform":5232},"translate(92.49 1.722)",[2279,5234],{"d":5225,"fill":2698,"stroke":2698,"className":5235,"style":2748},[2711],[2279,5237],{"fill":2702,"d":5238},"M45.702-36.284H71.31v-19.917H45.702Z",[2696,5240,5242],{"transform":5241},"translate(120.942 1.722)",[2279,5243],{"d":5225,"fill":2698,"stroke":2698,"className":5244,"style":2748},[2711],[2279,5246],{"fill":2702,"d":5247},"M-39.656-14.944h25.607v-19.917h-25.607Z",[2696,5249,5251],{"transform":5250},"translate(37.709 23.917)",[2279,5252],{"d":5215,"fill":2698,"stroke":2698,"className":5253,"style":2748},[2711],[2279,5255],{"fill":2702,"d":5256},"M-11.203-14.944h25.607v-19.917h-25.607Z",[2696,5258,5260],{"transform":5259},"translate(66.161 23.917)",[2279,5261],{"d":5262,"fill":2698,"stroke":2698,"className":5263,"style":2748},"M-64.206-47.554L-66.448-47.554L-66.448-47.851L-63.877-51.508Q-63.838-51.562-63.776-51.562L-63.631-51.562Q-63.581-51.562-63.549-51.531Q-63.518-51.500-63.518-51.449L-63.518-47.851L-62.686-47.851L-62.686-47.554L-63.518-47.554L-63.518-46.801Q-63.518-46.539-62.694-46.539L-62.694-46.242L-65.030-46.242L-65.030-46.539Q-64.206-46.539-64.206-46.801L-64.206-47.554M-64.151-50.656L-66.120-47.851L-64.151-47.851",[2711],[2279,5265],{"fill":2702,"d":5266},"M17.25-14.944h25.607v-19.917H17.25Z",[2696,5268,5270],{"transform":5269},"translate(94.614 23.917)",[2279,5271],{"d":5272,"fill":2698,"stroke":2698,"className":5273,"style":2748},"M-65.846-47.121L-65.909-47.121Q-65.768-46.769-65.444-46.558Q-65.120-46.347-64.733-46.347Q-64.139-46.347-63.889-46.781Q-63.639-47.215-63.639-47.851Q-63.639-48.445-63.809-48.892Q-63.979-49.340-64.479-49.340Q-64.776-49.340-64.981-49.260Q-65.186-49.179-65.288-49.088Q-65.389-48.996-65.504-48.863Q-65.620-48.730-65.670-48.715L-65.741-48.715Q-65.827-48.738-65.846-48.816L-65.846-51.465Q-65.815-51.562-65.741-51.562Q-65.725-51.562-65.717-51.560Q-65.709-51.558-65.702-51.554Q-65.116-51.304-64.518-51.304Q-63.936-51.304-63.319-51.562L-63.295-51.562Q-63.252-51.562-63.225-51.537Q-63.198-51.512-63.198-51.472L-63.198-51.394Q-63.198-51.363-63.221-51.340Q-63.518-50.988-63.940-50.791Q-64.362-50.594-64.823-50.594Q-65.170-50.594-65.549-50.699L-65.549-49.203Q-65.331-49.398-65.055-49.496Q-64.780-49.594-64.479-49.594Q-64.022-49.594-63.653-49.346Q-63.284-49.097-63.077-48.693Q-62.870-48.289-62.870-47.844Q-62.870-47.355-63.125-46.947Q-63.381-46.539-63.813-46.306Q-64.245-46.074-64.733-46.074Q-65.127-46.074-65.483-46.265Q-65.838-46.457-66.049-46.791Q-66.260-47.125-66.260-47.539Q-66.260-47.719-66.143-47.832Q-66.026-47.945-65.846-47.945Q-65.729-47.945-65.637-47.892Q-65.545-47.840-65.493-47.748Q-65.440-47.656-65.440-47.539Q-65.440-47.355-65.553-47.238Q-65.666-47.121-65.846-47.121",[2711],[2279,5275],{"fill":2702,"d":5276},"M45.702-14.944H71.31v-19.917H45.702Z",[2696,5278,5280],{"transform":5279},"translate(120.942 23.062)",[2279,5281],{"d":5225,"fill":2698,"stroke":2698,"className":5282,"style":2748},[2711],[2279,5284],{"fill":2702,"d":5285},"M-39.656 6.395h25.607v-19.917h-25.607Z",[2696,5287,5289],{"transform":5288},"translate(37.709 45.257)",[2279,5290],{"d":5215,"fill":2698,"stroke":2698,"className":5291,"style":2748},[2711],[2279,5293],{"fill":2702,"d":5294},"M-11.203 6.395h25.607v-19.917h-25.607Z",[2696,5296,5298],{"transform":5297},"translate(66.161 45.257)",[2279,5299],{"d":5262,"fill":2698,"stroke":2698,"className":5300,"style":2748},[2711],[2696,5302,5304,5307],{"fill":5303},"var(--tk-soft-accent)",[2279,5305],{"d":5306},"M17.25 6.395h25.607v-19.917H17.25Z",[2696,5308,5310],{"transform":5309},"translate(94.614 45.257)",[2279,5311],{"d":5312,"fill":2698,"stroke":2698,"className":5313,"style":2748},"M-63.100-46.242L-66.260-46.242L-66.260-46.449Q-66.260-46.476-66.237-46.508L-64.885-47.906Q-64.506-48.293-64.258-48.582Q-64.010-48.871-63.836-49.228Q-63.663-49.586-63.663-49.976Q-63.663-50.324-63.795-50.617Q-63.928-50.910-64.182-51.088Q-64.436-51.265-64.791-51.265Q-65.151-51.265-65.442-51.070Q-65.733-50.875-65.877-50.547L-65.823-50.547Q-65.639-50.547-65.514-50.426Q-65.389-50.304-65.389-50.113Q-65.389-49.933-65.514-49.804Q-65.639-49.676-65.823-49.676Q-66.002-49.676-66.131-49.804Q-66.260-49.933-66.260-50.113Q-66.260-50.515-66.040-50.851Q-65.819-51.187-65.454-51.375Q-65.088-51.562-64.686-51.562Q-64.206-51.562-63.790-51.375Q-63.374-51.187-63.122-50.826Q-62.870-50.465-62.870-49.976Q-62.870-49.617-63.024-49.314Q-63.178-49.012-63.430-48.752Q-63.682-48.492-64.032-48.207Q-64.381-47.922-64.549-47.769L-65.479-46.929L-64.764-46.929Q-63.389-46.929-63.350-46.969Q-63.280-47.047-63.237-47.232Q-63.194-47.418-63.151-47.707L-62.870-47.707",[2711],[2279,5315],{"fill":2702,"d":5316},"M45.702 6.395H71.31v-19.917H45.702Z",[2696,5318,5320],{"transform":5319},"translate(123.067 45.257)",[2279,5321],{"d":5322,"fill":2698,"stroke":2698,"className":5323,"style":2748},"M-66.334-47.465Q-66.334-47.961-66.008-48.326Q-65.682-48.691-65.159-48.937L-65.428-49.097Q-65.725-49.281-65.909-49.576Q-66.092-49.871-66.092-50.211Q-66.092-50.605-65.874-50.916Q-65.655-51.226-65.301-51.394Q-64.948-51.562-64.565-51.562Q-64.291-51.562-64.018-51.484Q-63.745-51.406-63.528-51.258Q-63.311-51.109-63.174-50.883Q-63.038-50.656-63.038-50.363Q-63.038-49.957-63.307-49.650Q-63.577-49.344-63.999-49.129L-63.549-48.859Q-63.331-48.722-63.163-48.529Q-62.995-48.336-62.897-48.097Q-62.799-47.859-62.799-47.601Q-62.799-47.262-62.950-46.974Q-63.100-46.687-63.346-46.490Q-63.592-46.293-63.916-46.183Q-64.241-46.074-64.565-46.074Q-64.995-46.074-65.401-46.236Q-65.807-46.398-66.071-46.717Q-66.334-47.035-66.334-47.465M-65.846-47.465Q-65.846-46.980-65.456-46.664Q-65.065-46.347-64.565-46.347Q-64.272-46.347-63.973-46.459Q-63.674-46.570-63.481-46.789Q-63.288-47.008-63.288-47.320Q-63.288-47.551-63.428-47.762Q-63.569-47.972-63.776-48.090L-64.885-48.769Q-65.303-48.566-65.575-48.230Q-65.846-47.894-65.846-47.465M-65.260-49.898L-64.272-49.297Q-63.924-49.480-63.698-49.750Q-63.471-50.019-63.471-50.363Q-63.471-50.582-63.563-50.758Q-63.655-50.933-63.809-51.056Q-63.963-51.179-64.165-51.250Q-64.366-51.320-64.565-51.320Q-64.971-51.320-65.317-51.109Q-65.663-50.898-65.663-50.515Q-65.663-50.332-65.551-50.170Q-65.440-50.008-65.260-49.898",[2711],[2279,5325],{"fill":2702,"d":5326},"M-39.656 27.735h25.607V7.818h-25.607Z",[2696,5328,5330],{"transform":5329},"translate(37.709 66.596)",[2279,5331],{"d":5215,"fill":2698,"stroke":2698,"className":5332,"style":2748},[2711],[2279,5334],{"fill":2702,"d":5335},"M-11.203 27.735h25.607V7.818h-25.607Z",[2696,5337,5339],{"transform":5338},"translate(66.161 66.596)",[2279,5340],{"d":5262,"fill":2698,"stroke":2698,"className":5341,"style":2748},[2711],[2279,5343],{"fill":2702,"d":5344},"M17.25 27.735h25.607V7.818H17.25Z",[2696,5346,5348],{"transform":5347},"translate(94.614 66.596)",[2279,5349],{"d":5312,"fill":2698,"stroke":2698,"className":5350,"style":2748},[2711],[2696,5352,5353,5356],{"fill":5303},[2279,5354],{"d":5355},"M45.702 27.735H71.31V7.818H45.702Z",[2696,5357,5359],{"transform":5358},"translate(123.067 66.596)",[2279,5360],{"d":5272,"fill":2698,"stroke":2698,"className":5361,"style":2748},[2711],[2696,5363,5364],{"fill":2800,"stroke":2800},[2696,5365,5366,5372,5378,5384,5390,5396,5402],{"fill":2800,"stroke":2702,"fontSize":5131},[2696,5367,5369],{"transform":5368},"translate(181.295 45.04)",[2279,5370],{"d":5120,"fill":2800,"stroke":2800,"className":5371,"style":2748},[2711],[2696,5373,5374],{"transform":5368},[2279,5375],{"d":5376,"fill":2800,"stroke":2800,"className":5377,"style":2748},"M-62.331-46.707Q-62.331-46.890-62.195-47.027Q-62.058-47.164-61.866-47.164Q-61.675-47.164-61.542-47.031Q-61.409-46.898-61.409-46.707Q-61.409-46.508-61.542-46.375Q-61.675-46.242-61.866-46.242Q-62.058-46.242-62.195-46.379Q-62.331-46.515-62.331-46.707M-62.331-49.234Q-62.331-49.418-62.195-49.554Q-62.058-49.691-61.866-49.691Q-61.675-49.691-61.542-49.558Q-61.409-49.426-61.409-49.234Q-61.409-49.035-61.542-48.902Q-61.675-48.769-61.866-48.769Q-62.058-48.769-62.195-48.906Q-62.331-49.043-62.331-49.234",[2711],[2696,5379,5380],{"transform":5368},[2279,5381],{"d":5382,"fill":2800,"stroke":2800,"className":5383,"style":2748},"M-54.431-47.554L-56.673-47.554L-56.673-47.851L-54.102-51.508Q-54.063-51.562-54.001-51.562L-53.856-51.562Q-53.806-51.562-53.774-51.531Q-53.743-51.500-53.743-51.449L-53.743-47.851L-52.911-47.851L-52.911-47.554L-53.743-47.554L-53.743-46.801Q-53.743-46.539-52.919-46.539L-52.919-46.242L-55.255-46.242L-55.255-46.539Q-54.431-46.539-54.431-46.801L-54.431-47.554M-54.376-50.656L-56.345-47.851L-54.376-47.851",[2711],[2696,5385,5386],{"transform":5368},[2279,5387],{"d":5388,"fill":2800,"stroke":2800,"className":5389,"style":2748},"M-46.942-48.058L-51.774-48.058Q-51.849-48.070-51.899-48.119Q-51.950-48.168-51.950-48.242Q-51.950-48.394-51.774-48.426L-46.942-48.426Q-46.774-48.398-46.774-48.242Q-46.774-48.086-46.942-48.058",[2711],[2696,5391,5392],{"transform":5368},[2279,5393],{"d":5394,"fill":2800,"stroke":2800,"className":5395,"style":2748},"M-42.463-46.242L-45.623-46.242L-45.623-46.449Q-45.623-46.476-45.600-46.508L-44.248-47.906Q-43.869-48.293-43.621-48.582Q-43.373-48.871-43.199-49.228Q-43.026-49.586-43.026-49.976Q-43.026-50.324-43.158-50.617Q-43.291-50.910-43.545-51.088Q-43.799-51.265-44.154-51.265Q-44.514-51.265-44.805-51.070Q-45.096-50.875-45.240-50.547L-45.186-50.547Q-45.002-50.547-44.877-50.426Q-44.752-50.304-44.752-50.113Q-44.752-49.933-44.877-49.804Q-45.002-49.676-45.186-49.676Q-45.365-49.676-45.494-49.804Q-45.623-49.933-45.623-50.113Q-45.623-50.515-45.403-50.851Q-45.182-51.187-44.817-51.375Q-44.451-51.562-44.049-51.562Q-43.569-51.562-43.153-51.375Q-42.736-51.187-42.485-50.826Q-42.233-50.465-42.233-49.976Q-42.233-49.617-42.387-49.314Q-42.541-49.012-42.793-48.752Q-43.045-48.492-43.395-48.207Q-43.744-47.922-43.912-47.769L-44.842-46.929L-44.127-46.929Q-42.752-46.929-42.713-46.969Q-42.643-47.047-42.600-47.232Q-42.557-47.418-42.514-47.707L-42.233-47.707",[2711],[2696,5397,5398],{"transform":5368},[2279,5399],{"d":5400,"fill":2800,"stroke":2800,"className":5401,"style":2748},"M-35.838-47.219L-41.151-47.219Q-41.229-47.226-41.278-47.275Q-41.326-47.324-41.326-47.402Q-41.326-47.472-41.279-47.523Q-41.233-47.574-41.151-47.586L-35.838-47.586Q-35.764-47.574-35.717-47.523Q-35.670-47.472-35.670-47.402Q-35.670-47.324-35.719-47.275Q-35.768-47.226-35.838-47.219M-35.838-48.906L-41.151-48.906Q-41.229-48.914-41.278-48.963Q-41.326-49.012-41.326-49.090Q-41.326-49.160-41.279-49.211Q-41.233-49.262-41.151-49.273L-35.838-49.273Q-35.764-49.262-35.717-49.211Q-35.670-49.160-35.670-49.090Q-35.670-49.012-35.719-48.963Q-35.768-48.914-35.838-48.906",[2711],[2696,5403,5404],{"transform":5368},[2279,5405],{"d":5406,"fill":2800,"stroke":2800,"className":5407,"style":2748},"M-31.602-46.242L-34.762-46.242L-34.762-46.449Q-34.762-46.476-34.739-46.508L-33.387-47.906Q-33.008-48.293-32.760-48.582Q-32.512-48.871-32.338-49.228Q-32.165-49.586-32.165-49.976Q-32.165-50.324-32.297-50.617Q-32.430-50.910-32.684-51.088Q-32.938-51.265-33.293-51.265Q-33.653-51.265-33.944-51.070Q-34.235-50.875-34.379-50.547L-34.325-50.547Q-34.141-50.547-34.016-50.426Q-33.891-50.304-33.891-50.113Q-33.891-49.933-34.016-49.804Q-34.141-49.676-34.325-49.676Q-34.504-49.676-34.633-49.804Q-34.762-49.933-34.762-50.113Q-34.762-50.515-34.542-50.851Q-34.321-51.187-33.956-51.375Q-33.590-51.562-33.188-51.562Q-32.708-51.562-32.292-51.375Q-31.876-51.187-31.624-50.826Q-31.372-50.465-31.372-49.976Q-31.372-49.617-31.526-49.314Q-31.680-49.012-31.932-48.752Q-32.184-48.492-32.534-48.207Q-32.883-47.922-33.051-47.769L-33.981-46.929L-33.266-46.929Q-31.891-46.929-31.852-46.969Q-31.782-47.047-31.739-47.232Q-31.696-47.418-31.653-47.707L-31.372-47.707",[2711],[2696,5409,5410],{"fill":2800,"stroke":2800},[2696,5411,5412,5418,5424,5430,5436,5442,5448],{"fill":2800,"stroke":2702,"fontSize":5131},[2696,5413,5415],{"transform":5414},"translate(181.579 66.18)",[2279,5416],{"d":5127,"fill":2800,"stroke":2800,"className":5417,"style":2748},[2711],[2696,5419,5420],{"transform":5414},[2279,5421],{"d":5422,"fill":2800,"stroke":2800,"className":5423,"style":2748},"M-62.897-46.707Q-62.897-46.890-62.761-47.027Q-62.624-47.164-62.432-47.164Q-62.241-47.164-62.108-47.031Q-61.975-46.898-61.975-46.707Q-61.975-46.508-62.108-46.375Q-62.241-46.242-62.432-46.242Q-62.624-46.242-62.761-46.379Q-62.897-46.515-62.897-46.707M-62.897-49.234Q-62.897-49.418-62.761-49.554Q-62.624-49.691-62.432-49.691Q-62.241-49.691-62.108-49.558Q-61.975-49.426-61.975-49.234Q-61.975-49.035-62.108-48.902Q-62.241-48.769-62.432-48.769Q-62.624-48.769-62.761-48.906Q-62.897-49.043-62.897-49.234",[2711],[2696,5425,5426],{"transform":5414},[2279,5427],{"d":5428,"fill":2800,"stroke":2800,"className":5429,"style":2748},"M-53.891-46.242L-57.051-46.242L-57.051-46.449Q-57.051-46.476-57.028-46.508L-55.676-47.906Q-55.297-48.293-55.049-48.582Q-54.801-48.871-54.627-49.228Q-54.454-49.586-54.454-49.976Q-54.454-50.324-54.586-50.617Q-54.719-50.910-54.973-51.088Q-55.227-51.265-55.582-51.265Q-55.942-51.265-56.233-51.070Q-56.524-50.875-56.668-50.547L-56.614-50.547Q-56.430-50.547-56.305-50.426Q-56.180-50.304-56.180-50.113Q-56.180-49.933-56.305-49.804Q-56.430-49.676-56.614-49.676Q-56.793-49.676-56.922-49.804Q-57.051-49.933-57.051-50.113Q-57.051-50.515-56.831-50.851Q-56.610-51.187-56.245-51.375Q-55.879-51.562-55.477-51.562Q-54.997-51.562-54.581-51.375Q-54.164-51.187-53.913-50.826Q-53.661-50.465-53.661-49.976Q-53.661-49.617-53.815-49.314Q-53.969-49.012-54.221-48.752Q-54.473-48.492-54.823-48.207Q-55.172-47.922-55.340-47.769L-56.270-46.929L-55.555-46.929Q-54.180-46.929-54.141-46.969Q-54.071-47.047-54.028-47.232Q-53.985-47.418-53.942-47.707L-53.661-47.707",[2711],[2696,5431,5432],{"transform":5414},[2279,5433],{"d":5434,"fill":2800,"stroke":2800,"className":5435,"style":2748},"M-50.106-48.058L-52.579-48.058Q-52.657-48.070-52.706-48.119Q-52.754-48.168-52.754-48.242Q-52.754-48.316-52.706-48.365Q-52.657-48.414-52.579-48.426L-50.106-48.426L-50.106-50.906Q-50.079-51.074-49.922-51.074Q-49.848-51.074-49.799-51.025Q-49.750-50.976-49.739-50.906L-49.739-48.426L-47.266-48.426Q-47.098-48.394-47.098-48.242Q-47.098-48.090-47.266-48.058L-49.739-48.058L-49.739-45.578Q-49.750-45.508-49.799-45.459Q-49.848-45.410-49.922-45.410Q-50.079-45.410-50.106-45.578",[2711],[2696,5437,5438],{"transform":5414},[2279,5439],{"d":5440,"fill":2800,"stroke":2800,"className":5441,"style":2748},"M-45.823-46.875Q-45.632-46.601-45.276-46.474Q-44.921-46.347-44.538-46.347Q-44.202-46.347-43.993-46.533Q-43.784-46.719-43.688-47.012Q-43.593-47.304-43.593-47.617Q-43.593-47.941-43.690-48.236Q-43.788-48.531-44.001-48.715Q-44.214-48.898-44.546-48.898L-45.112-48.898Q-45.143-48.898-45.173-48.928Q-45.202-48.957-45.202-48.984L-45.202-49.066Q-45.202-49.101-45.173-49.127Q-45.143-49.152-45.112-49.152L-44.632-49.187Q-44.346-49.187-44.149-49.392Q-43.952-49.597-43.856-49.892Q-43.761-50.187-43.761-50.465Q-43.761-50.844-43.960-51.082Q-44.159-51.320-44.538-51.320Q-44.858-51.320-45.147-51.213Q-45.436-51.105-45.600-50.883Q-45.421-50.883-45.298-50.756Q-45.175-50.629-45.175-50.457Q-45.175-50.285-45.300-50.160Q-45.425-50.035-45.600-50.035Q-45.772-50.035-45.897-50.160Q-46.022-50.285-46.022-50.457Q-46.022-50.824-45.798-51.072Q-45.573-51.320-45.233-51.441Q-44.893-51.562-44.538-51.562Q-44.190-51.562-43.827-51.441Q-43.464-51.320-43.216-51.070Q-42.968-50.820-42.968-50.465Q-42.968-49.980-43.286-49.597Q-43.604-49.215-44.081-49.043Q-43.530-48.933-43.130-48.547Q-42.729-48.160-42.729-47.625Q-42.729-47.168-42.993-46.812Q-43.257-46.457-43.678-46.265Q-44.100-46.074-44.538-46.074Q-44.948-46.074-45.341-46.209Q-45.733-46.344-45.999-46.629Q-46.264-46.914-46.264-47.332Q-46.264-47.527-46.132-47.656Q-45.999-47.785-45.807-47.785Q-45.682-47.785-45.579-47.726Q-45.475-47.668-45.413-47.562Q-45.350-47.457-45.350-47.332Q-45.350-47.137-45.485-47.006Q-45.620-46.875-45.823-46.875",[2711],[2696,5443,5444],{"transform":5414},[2279,5445],{"d":5446,"fill":2800,"stroke":2800,"className":5447,"style":2748},"M-36.405-47.219L-41.718-47.219Q-41.796-47.226-41.845-47.275Q-41.893-47.324-41.893-47.402Q-41.893-47.472-41.846-47.523Q-41.800-47.574-41.718-47.586L-36.405-47.586Q-36.331-47.574-36.284-47.523Q-36.237-47.472-36.237-47.402Q-36.237-47.324-36.286-47.275Q-36.335-47.226-36.405-47.219M-36.405-48.906L-41.718-48.906Q-41.796-48.914-41.845-48.963Q-41.893-49.012-41.893-49.090Q-41.893-49.160-41.846-49.211Q-41.800-49.262-41.718-49.273L-36.405-49.273Q-36.331-49.262-36.284-49.211Q-36.237-49.160-36.237-49.090Q-36.237-49.012-36.286-48.963Q-36.335-48.914-36.405-48.906",[2711],[2696,5449,5450],{"transform":5414},[2279,5451],{"d":5452,"fill":2800,"stroke":2800,"className":5453,"style":2748},"M-34.915-47.121L-34.978-47.121Q-34.837-46.769-34.513-46.558Q-34.189-46.347-33.802-46.347Q-33.208-46.347-32.958-46.781Q-32.708-47.215-32.708-47.851Q-32.708-48.445-32.878-48.892Q-33.048-49.340-33.548-49.340Q-33.845-49.340-34.050-49.260Q-34.255-49.179-34.357-49.088Q-34.458-48.996-34.573-48.863Q-34.689-48.730-34.739-48.715L-34.810-48.715Q-34.896-48.738-34.915-48.816L-34.915-51.465Q-34.884-51.562-34.810-51.562Q-34.794-51.562-34.786-51.560Q-34.778-51.558-34.771-51.554Q-34.185-51.304-33.587-51.304Q-33.005-51.304-32.388-51.562L-32.364-51.562Q-32.321-51.562-32.294-51.537Q-32.267-51.512-32.267-51.472L-32.267-51.394Q-32.267-51.363-32.290-51.340Q-32.587-50.988-33.009-50.791Q-33.431-50.594-33.892-50.594Q-34.239-50.594-34.618-50.699L-34.618-49.203Q-34.400-49.398-34.124-49.496Q-33.849-49.594-33.548-49.594Q-33.091-49.594-32.722-49.346Q-32.353-49.097-32.146-48.693Q-31.939-48.289-31.939-47.844Q-31.939-47.355-32.194-46.947Q-32.450-46.539-32.882-46.306Q-33.314-46.074-33.802-46.074Q-34.196-46.074-34.552-46.265Q-34.907-46.457-35.118-46.791Q-35.329-47.125-35.329-47.539Q-35.329-47.719-35.212-47.832Q-35.095-47.945-34.915-47.945Q-34.798-47.945-34.706-47.892Q-34.614-47.840-34.562-47.748Q-34.509-47.656-34.509-47.539Q-34.509-47.355-34.622-47.238Q-34.735-47.121-34.915-47.121",[2711],[3022,5455,5457,5458,5519,5520,5553,5554,5582,5583,5598,5599,5614],{"className":5456},[3025],"Bellman–Ford as a DP over path length: ",[444,5459,5461],{"className":5460},[447],[444,5462,5464],{"className":5463,"ariaHidden":452},[451],[444,5465,5467,5470,5510,5513,5516],{"className":5466},[456],[444,5468],{"className":5469,"style":501},[460],[444,5471,5473,5476],{"className":5472},[465],[444,5474,3886],{"className":5475,"style":3885},[465,466],[444,5477,5479],{"className":5478},[696],[444,5480,5482,5502],{"className":5481},[700,701],[444,5483,5485,5499],{"className":5484},[705],[444,5486,5488],{"className":5487,"style":3899},[709],[444,5489,5490,5493],{"style":3902},[444,5491],{"className":5492,"style":718},[717],[444,5494,5496],{"className":5495},[722,723,724,725],[444,5497,3912],{"className":5498},[465,466,725],[444,5500,735],{"className":5501},[734],[444,5503,5505],{"className":5504},[705],[444,5506,5508],{"className":5507,"style":742},[709],[444,5509],{},[444,5511,748],{"className":5512},[505],[444,5514,525],{"className":5515,"style":524},[465,466],[444,5517,756],{"className":5518},[529]," = cheapest ",[444,5521,5523],{"className":5522},[447],[444,5524,5526,5544],{"className":5525,"ariaHidden":452},[451],[444,5527,5529,5532,5535,5538,5541],{"className":5528},[456],[444,5530],{"className":5531,"style":544},[460],[444,5533,3949],{"className":5534},[465,466],[444,5536],{"className":5537,"style":1150},[519],[444,5539,3733],{"className":5540},[1154],[444,5542],{"className":5543,"style":1150},[519],[444,5545,5547,5550],{"className":5546},[456],[444,5548],{"className":5549,"style":544},[460],[444,5551,525],{"className":5552,"style":524},[465,466]," using ",[444,5555,5557],{"className":5556},[447],[444,5558,5560,5573],{"className":5559,"ariaHidden":452},[451],[444,5561,5563,5566,5570],{"className":5562},[456],[444,5564],{"className":5565,"style":4783},[460],[444,5567,5569],{"className":5568},[1154],"≤",[444,5571],{"className":5572,"style":1150},[519],[444,5574,5576,5579],{"className":5575},[456],[444,5577],{"className":5578,"style":3584},[460],[444,5580,3912],{"className":5581},[465,466]," edges; each round relaxes against the previous layer, so capping ",[444,5584,5586],{"className":5585},[447],[444,5587,5589],{"className":5588,"ariaHidden":452},[451],[444,5590,5592,5595],{"className":5591},[456],[444,5593],{"className":5594,"style":3584},[460],[444,5596,3912],{"className":5597},[465,466]," solves the ",[444,5600,5602],{"className":5601},[447],[444,5603,5605],{"className":5604,"ariaHidden":452},[451],[444,5606,5608,5611],{"className":5607},[456],[444,5609],{"className":5610,"style":461},[460],[444,5612,468],{"className":5613,"style":467},[465,466],"-stops variant",[665,5616,5617],{"type":3482},[381,5618,5619,5622,5623,5638,5639,5642,5643,5704,5705,5766],{},[389,5620,5621],{},"Remark (snapshot the layer)."," With the ",[444,5624,5626],{"className":5625},[447],[444,5627,5629],{"className":5628,"ariaHidden":452},[451],[444,5630,5632,5635],{"className":5631},[456],[444,5633],{"className":5634,"style":461},[460],[444,5636,468],{"className":5637,"style":467},[465,466],"-stops cap you must relax against\nthe ",[397,5640,5641],{},"previous"," layer ",[444,5644,5646],{"className":5645},[447],[444,5647,5649],{"className":5648,"ariaHidden":452},[451],[444,5650,5652,5655],{"className":5651},[456],[444,5653],{"className":5654,"style":4686},[460],[444,5656,5658,5661],{"className":5657},[465],[444,5659,3886],{"className":5660,"style":3885},[465,466],[444,5662,5664],{"className":5663},[696],[444,5665,5667,5696],{"className":5666},[700,701],[444,5668,5670,5693],{"className":5669},[705],[444,5671,5673],{"className":5672,"style":980},[709],[444,5674,5675,5678],{"style":3902},[444,5676],{"className":5677,"style":718},[717],[444,5679,5681],{"className":5680},[722,723,724,725],[444,5682,5684,5687,5690],{"className":5683},[465,725],[444,5685,3912],{"className":5686},[465,466,725],[444,5688,1346],{"className":5689},[1345,725],[444,5691,609],{"className":5692},[465,725],[444,5694,735],{"className":5695},[734],[444,5697,5699],{"className":5698},[705],[444,5700,5702],{"className":5701,"style":2357},[709],[444,5703],{},", not the layer being filled, since otherwise a path\nupdated earlier in the same sweep could be reused, smuggling in an extra edge.\nCopy ",[444,5706,5708],{"className":5707},[447],[444,5709,5711],{"className":5710,"ariaHidden":452},[451],[444,5712,5714,5717],{"className":5713},[456],[444,5715],{"className":5716,"style":4686},[460],[444,5718,5720,5723],{"className":5719},[465],[444,5721,3886],{"className":5722,"style":3885},[465,466],[444,5724,5726],{"className":5725},[696],[444,5727,5729,5758],{"className":5728},[700,701],[444,5730,5732,5755],{"className":5731},[705],[444,5733,5735],{"className":5734,"style":980},[709],[444,5736,5737,5740],{"style":3902},[444,5738],{"className":5739,"style":718},[717],[444,5741,5743],{"className":5742},[722,723,724,725],[444,5744,5746,5749,5752],{"className":5745},[465,725],[444,5747,3912],{"className":5748},[465,466,725],[444,5750,1346],{"className":5751},[1345,725],[444,5753,609],{"className":5754},[465,725],[444,5756,735],{"className":5757},[734],[444,5759,5761],{"className":5760},[705],[444,5762,5764],{"className":5763,"style":2357},[709],[444,5765],{}," before each round (or relax the original edge list into a fresh\narray). The unbounded version may safely update in place, since extra\nrelaxations only help once the edge budget is irrelevant.",[611,5768,5770],{"id":5769},"dag-dp-a-topological-prefix-as-the-resource","DAG-DP: a topological prefix as the resource",[381,5772,5773,5774,5777,5778,5781,5782,5797,5798,5822,5823,5853,5854,5857,5858,5891,5892,5910,5911,5926],{},"When the graph is ",[389,5775,5776],{},"acyclic",", the resource becomes trivial to ration: process\nvertices in\n",[385,5779,5780],{"href":165},"topological order",". A topological\norder lists every vertex after\nall of its predecessors, so by the time we reach ",[444,5783,5785],{"className":5784},[447],[444,5786,5788],{"className":5787,"ariaHidden":452},[451],[444,5789,5791,5794],{"className":5790},[456],[444,5792],{"className":5793,"style":544},[460],[444,5795,525],{"className":5796,"style":524},[465,466],", every ",[444,5799,5801],{"className":5800},[447],[444,5802,5804],{"className":5803,"ariaHidden":452},[451],[444,5805,5807,5810,5813,5816,5819],{"className":5806},[456],[444,5808],{"className":5809,"style":501},[460],[444,5811,3886],{"className":5812,"style":3885},[465,466],[444,5814,748],{"className":5815},[505],[444,5817,510],{"className":5818},[465,466],[444,5820,756],{"className":5821},[529]," for an\nincoming edge ",[444,5824,5826],{"className":5825},[447],[444,5827,5829],{"className":5828,"ariaHidden":452},[451],[444,5830,5832,5835,5838,5841,5844,5847,5850],{"className":5831},[456],[444,5833],{"className":5834,"style":501},[460],[444,5836,506],{"className":5837},[505],[444,5839,510],{"className":5840},[465,466],[444,5842,515],{"className":5843},[514],[444,5845],{"className":5846,"style":520},[519],[444,5848,525],{"className":5849,"style":524},[465,466],[444,5851,530],{"className":5852},[529]," is already final. The recurrence has no cycles, so a\n",[389,5855,5856],{},"single pass"," suffices, with no convergence over ",[444,5859,5861],{"className":5860},[447],[444,5862,5864,5882],{"className":5863,"ariaHidden":452},[451],[444,5865,5867,5870,5873,5876,5879],{"className":5866},[456],[444,5868],{"className":5869,"style":4651},[460],[444,5871,658],{"className":5872,"style":657},[465,466],[444,5874],{"className":5875,"style":657},[519],[444,5877,1346],{"className":5878},[1345],[444,5880],{"className":5881,"style":657},[519],[444,5883,5885,5888],{"className":5884},[456],[444,5886],{"className":5887,"style":1127},[460],[444,5889,609],{"className":5890},[465]," rounds and no ",[444,5893,5895],{"className":5894},[447],[444,5896,5898],{"className":5897,"ariaHidden":452},[451],[444,5899,5901,5904],{"className":5900},[456],[444,5902],{"className":5903,"style":577},[460],[444,5905,5907],{"className":5906},[581],[444,5908,586],{"className":5909},[465,585],"\nover ",[444,5912,5914],{"className":5913},[447],[444,5915,5917],{"className":5916,"ariaHidden":452},[451],[444,5918,5920,5923],{"className":5919},[456],[444,5921],{"className":5922,"style":1295},[460],[444,5924,730],{"className":5925,"style":729},[465,466]," layers.",[3301,5928,5930],{"className":3303,"code":5929,"language":3305,"meta":376,"style":376},"caption: $\\textsc{DAG-Relax}(G, s)$ — shortest\u002Flongest paths on a DAG in $O(V+E)$\n$\\text{topologically sort } G$\n$D[v] \\gets \\infty$ for all $v$;  $D[s] \\gets 0$\nfor each $u$ in topological order do\n  for each edge $(u,v)$ do\n    if $D[u] + w(u,v) \u003C D[v]$ then  \u002F\u002F use $\\max$ for longest path\n      $D[v] \\gets D[u] + w(u,v)$\nreturn $D$\n",[3307,5931,5932,5937,5942,5947,5952,5957,5962,5967],{"__ignoreMap":376},[444,5933,5934],{"class":3311,"line":6},[444,5935,5936],{},"caption: $\\textsc{DAG-Relax}(G, s)$ — shortest\u002Flongest paths on a DAG in $O(V+E)$\n",[444,5938,5939],{"class":3311,"line":18},[444,5940,5941],{},"$\\text{topologically sort } G$\n",[444,5943,5944],{"class":3311,"line":24},[444,5945,5946],{},"$D[v] \\gets \\infty$ for all $v$;  $D[s] \\gets 0$\n",[444,5948,5949],{"class":3311,"line":73},[444,5950,5951],{},"for each $u$ in topological order do\n",[444,5953,5954],{"class":3311,"line":102},[444,5955,5956],{},"  for each edge $(u,v)$ do\n",[444,5958,5959],{"class":3311,"line":108},[444,5960,5961],{},"    if $D[u] + w(u,v) \u003C D[v]$ then  \u002F\u002F use $\\max$ for longest path\n",[444,5963,5964],{"class":3311,"line":116},[444,5965,5966],{},"      $D[v] \\gets D[u] + w(u,v)$\n",[444,5968,5969],{"class":3311,"line":196},[444,5970,5971],{},"return $D$\n",[381,5973,5974,5975,6017,6018,6021,6022,6025,6026,6044,6045,6064,6065],{},"Each vertex and edge is touched once, so DAG-DP runs in ",[444,5976,5978],{"className":5977},[447],[444,5979,5981,6005],{"className":5980,"ariaHidden":452},[451],[444,5982,5984,5987,5990,5993,5996,5999,6002],{"className":5983},[456],[444,5985],{"className":5986,"style":501},[460],[444,5988,3374],{"className":5989},[465],[444,5991,506],{"className":5992},[505],[444,5994,658],{"className":5995,"style":657},[465,466],[444,5997],{"className":5998,"style":657},[519],[444,6000,1185],{"className":6001},[1345],[444,6003],{"className":6004,"style":657},[519],[444,6006,6008,6011,6014],{"className":6007},[456],[444,6009],{"className":6010,"style":501},[460],[444,6012,4497],{"className":6013,"style":4496},[465,466],[444,6015,530],{"className":6016},[529],", faster\nthan Dijkstra and immune to negative weights, because acyclicity replaces the\nnon-negativity that Dijkstra needs. The ",[389,6019,6020],{},"longest path"," problem,\nNP-hard in general graphs, is ",[397,6023,6024],{},"just as easy"," on a DAG: swap ",[444,6027,6029],{"className":6028},[447],[444,6030,6032],{"className":6031,"ariaHidden":452},[451],[444,6033,6035,6038],{"className":6034},[456],[444,6036],{"className":6037,"style":577},[460],[444,6039,6041],{"className":6040},[581],[444,6042,586],{"className":6043},[465,585]," for ",[444,6046,6048],{"className":6047},[447],[444,6049,6051],{"className":6050,"ariaHidden":452},[451],[444,6052,6054,6057],{"className":6053},[456],[444,6055],{"className":6056,"style":544},[460],[444,6058,6060],{"className":6059},[581],[444,6061,6063],{"className":6062},[465,585],"max",".\nAcyclicity is what makes the difference.",[601,6066,6067],{},[385,6068,6072],{"href":6069,"ariaDescribedBy":6070,"dataFootnoteRef":376,"id":6071},"#user-content-fn-skiena-dag",[607],"user-content-fnref-skiena-dag","4",[2685,6074,6076,6204],{"className":6075},[2688,2689],[2271,6077,6081],{"xmlns":2273,"width":6078,"height":6079,"viewBox":6080},"233.663","186.303","-75 -75 175.247 139.728",[2696,6082,6083,6086,6094,6097,6104,6107,6114,6117,6124,6131,6138,6145,6152,6155,6158,6164,6167,6170,6176,6191,6194,6197],{"stroke":2698,"style":2699},[2279,6084],{"fill":2702,"d":6085},"M-39.796-5.406c0-7.072-5.732-12.804-12.804-12.804-7.071 0-12.803 5.732-12.803 12.804 0 7.071 5.732 12.803 12.803 12.803s12.804-5.732 12.804-12.803Zm-12.804 0",[2696,6087,6089],{"transform":6088},"translate(-2.45 1.937)",[2279,6090],{"d":6091,"fill":2698,"stroke":2698,"className":6092,"style":6093},"M-50.978-5.305Q-51.374-5.305-51.660-5.509Q-51.945-5.714-52.092-6.048Q-52.240-6.382-52.240-6.773Q-52.240-7.208-52.066-7.669Q-51.892-8.131-51.580-8.522Q-51.268-8.913-50.858-9.148Q-50.447-9.383-50.007-9.383Q-49.739-9.383-49.522-9.245Q-49.304-9.106-49.172-8.860Q-49.133-9.010-49.025-9.106Q-48.917-9.203-48.777-9.203Q-48.654-9.203-48.570-9.130Q-48.487-9.058-48.487-8.935Q-48.487-8.882-48.496-8.851L-49.115-6.360Q-49.172-6.162-49.172-5.964Q-49.172-5.569-48.909-5.569Q-48.623-5.569-48.489-5.892Q-48.355-6.215-48.236-6.720Q-48.227-6.751-48.203-6.775Q-48.179-6.799-48.144-6.799L-48.038-6.799Q-47.990-6.799-47.968-6.766Q-47.946-6.733-47.946-6.685Q-48.060-6.254-48.151-6.001Q-48.241-5.749-48.434-5.527Q-48.627-5.305-48.926-5.305Q-49.234-5.305-49.482-5.476Q-49.730-5.648-49.801-5.938Q-50.056-5.652-50.352-5.479Q-50.649-5.305-50.978-5.305M-50.961-5.569Q-50.631-5.569-50.321-5.810Q-50.012-6.052-49.801-6.368Q-49.792-6.377-49.792-6.395L-49.295-8.359Q-49.352-8.676-49.544-8.900Q-49.735-9.124-50.025-9.124Q-50.394-9.124-50.693-8.805Q-50.992-8.487-51.159-8.078Q-51.295-7.731-51.420-7.221Q-51.545-6.711-51.545-6.386Q-51.545-6.061-51.407-5.815Q-51.268-5.569-50.961-5.569",[2711],"stroke-width:0.270",[2279,6095],{"fill":2702,"d":6096},"M28.49-31.014c0-7.07-5.732-12.803-12.803-12.803S2.883-38.085 2.883-31.014 8.615-18.21 15.687-18.21c7.071 0 12.804-5.732 12.804-12.804Zm-12.803 0",[2696,6098,6100],{"transform":6099},"translate(66.304 -22.482)",[2279,6101],{"d":6102,"fill":2698,"stroke":2698,"className":6103,"style":6093},"M-50.978-5.305Q-51.554-5.305-51.875-5.736Q-52.196-6.166-52.196-6.746Q-52.196-7.151-52.112-7.379L-51.233-10.877Q-51.198-11.027-51.198-11.101Q-51.198-11.238-51.765-11.238Q-51.862-11.238-51.862-11.356Q-51.862-11.413-51.831-11.484Q-51.800-11.554-51.734-11.554L-50.513-11.651Q-50.460-11.651-50.427-11.622Q-50.394-11.593-50.394-11.545L-50.394-11.510L-51.053-8.900Q-50.530-9.383-50.007-9.383Q-49.621-9.383-49.330-9.179Q-49.040-8.974-48.893-8.640Q-48.746-8.306-48.746-7.915Q-48.746-7.331-49.049-6.722Q-49.352-6.114-49.873-5.709Q-50.394-5.305-50.978-5.305M-50.961-5.569Q-50.592-5.569-50.288-5.892Q-49.985-6.215-49.827-6.610Q-49.682-6.966-49.561-7.474Q-49.440-7.981-49.440-8.302Q-49.440-8.627-49.585-8.875Q-49.730-9.124-50.025-9.124Q-50.627-9.124-51.198-8.324L-51.440-7.331Q-51.585-6.707-51.585-6.443Q-51.585-6.100-51.433-5.834Q-51.282-5.569-50.961-5.569",[2711],[2279,6105],{"fill":2702,"d":6106},"M28.49 20.201c0-7.071-5.732-12.804-12.803-12.804S2.883 13.13 2.883 20.201s5.732 12.804 12.804 12.804c7.071 0 12.804-5.733 12.804-12.804Zm-12.803 0",[2696,6108,6110],{"transform":6109},"translate(66.284 27.545)",[2279,6111],{"d":6112,"fill":2698,"stroke":2698,"className":6113,"style":6093},"M-51.510-6.513Q-51.510-6.118-51.297-5.843Q-51.084-5.569-50.702-5.569Q-50.157-5.569-49.651-5.804Q-49.146-6.039-48.829-6.461Q-48.808-6.496-48.746-6.496Q-48.689-6.496-48.643-6.445Q-48.597-6.395-48.597-6.342Q-48.597-6.307-48.623-6.281Q-48.970-5.806-49.533-5.555Q-50.095-5.305-50.719-5.305Q-51.150-5.305-51.499-5.507Q-51.849-5.709-52.040-6.065Q-52.231-6.421-52.231-6.847Q-52.231-7.309-52.029-7.766Q-51.827-8.223-51.471-8.592Q-51.115-8.961-50.671-9.172Q-50.227-9.383-49.757-9.383Q-49.489-9.383-49.240-9.302Q-48.992-9.220-48.825-9.042Q-48.658-8.864-48.658-8.601Q-48.658-8.364-48.808-8.186Q-48.957-8.008-49.190-8.008Q-49.330-8.008-49.436-8.102Q-49.541-8.197-49.541-8.342Q-49.541-8.544-49.394-8.698Q-49.247-8.851-49.045-8.851Q-49.150-8.992-49.355-9.058Q-49.559-9.124-49.766-9.124Q-50.302-9.124-50.699-8.695Q-51.097-8.267-51.304-7.647Q-51.510-7.028-51.510-6.513",[2711],[2279,6115],{"fill":2702,"d":6116},"M96.777-5.406c0-7.072-5.732-12.804-12.803-12.804S71.17-12.478 71.17-5.406c0 7.071 5.732 12.803 12.804 12.803 7.071 0 12.803-5.732 12.803-12.803Zm-12.803 0",[2696,6118,6120],{"transform":6119},"translate(134.177 3.125)",[2279,6121],{"d":6122,"fill":2698,"stroke":2698,"className":6123,"style":6093},"M-50.978-5.305Q-51.374-5.305-51.660-5.509Q-51.945-5.714-52.092-6.048Q-52.240-6.382-52.240-6.773Q-52.240-7.208-52.066-7.669Q-51.892-8.131-51.580-8.522Q-51.268-8.913-50.858-9.148Q-50.447-9.383-50.007-9.383Q-49.739-9.383-49.522-9.245Q-49.304-9.106-49.172-8.860L-48.667-10.877Q-48.632-11.027-48.632-11.101Q-48.632-11.238-49.199-11.238Q-49.295-11.238-49.295-11.356Q-49.295-11.413-49.265-11.484Q-49.234-11.554-49.172-11.554L-47.946-11.651Q-47.893-11.651-47.863-11.622Q-47.832-11.593-47.832-11.545L-47.832-11.510L-49.115-6.360Q-49.115-6.302-49.144-6.171Q-49.172-6.039-49.172-5.964Q-49.172-5.569-48.909-5.569Q-48.623-5.569-48.489-5.892Q-48.355-6.215-48.236-6.720Q-48.227-6.751-48.203-6.775Q-48.179-6.799-48.144-6.799L-48.038-6.799Q-47.990-6.799-47.968-6.766Q-47.946-6.733-47.946-6.685Q-48.060-6.254-48.151-6.001Q-48.241-5.749-48.434-5.527Q-48.627-5.305-48.926-5.305Q-49.234-5.305-49.482-5.476Q-49.730-5.648-49.801-5.938Q-50.056-5.652-50.352-5.479Q-50.649-5.305-50.978-5.305M-50.961-5.569Q-50.631-5.569-50.321-5.810Q-50.012-6.052-49.801-6.368Q-49.792-6.377-49.792-6.404L-49.295-8.359Q-49.352-8.676-49.544-8.900Q-49.735-9.124-50.025-9.124Q-50.394-9.124-50.693-8.805Q-50.992-8.487-51.159-8.078Q-51.295-7.731-51.420-7.221Q-51.545-6.711-51.545-6.386Q-51.545-6.061-51.407-5.815Q-51.268-5.569-50.961-5.569",[2711],[2696,6125,6127],{"transform":6126},"translate(-2.125 -25.875)",[2279,6128],{"d":6129,"fill":2698,"stroke":2698,"className":6130,"style":2748},"M-50.479-5.238Q-51.182-5.238-51.582-5.638Q-51.983-6.039-52.127-6.648Q-52.272-7.258-52.272-7.957Q-52.272-8.480-52.202-8.943Q-52.131-9.406-51.938-9.818Q-51.745-10.230-51.387-10.478Q-51.030-10.726-50.479-10.726Q-49.928-10.726-49.571-10.478Q-49.213-10.230-49.022-9.820Q-48.830-9.410-48.760-8.941Q-48.690-8.472-48.690-7.957Q-48.690-7.258-48.832-6.650Q-48.975-6.043-49.375-5.640Q-49.776-5.238-50.479-5.238M-50.479-5.496Q-50.006-5.496-49.774-5.931Q-49.541-6.367-49.487-6.906Q-49.432-7.445-49.432-8.086Q-49.432-9.082-49.616-9.775Q-49.799-10.468-50.479-10.468Q-50.846-10.468-51.067-10.230Q-51.288-9.992-51.383-9.635Q-51.479-9.277-51.504-8.906Q-51.530-8.535-51.530-8.086Q-51.530-7.445-51.475-6.906Q-51.420-6.367-51.188-5.931Q-50.955-5.496-50.479-5.496",[2711],[2696,6132,6134],{"transform":6133},"translate(66.161 -51.482)",[2279,6135],{"d":6136,"fill":2698,"stroke":2698,"className":6137,"style":2748},"M-51.807-6.039Q-51.616-5.765-51.260-5.638Q-50.905-5.511-50.522-5.511Q-50.186-5.511-49.977-5.697Q-49.768-5.883-49.672-6.176Q-49.577-6.468-49.577-6.781Q-49.577-7.105-49.674-7.400Q-49.772-7.695-49.985-7.879Q-50.198-8.062-50.530-8.062L-51.096-8.062Q-51.127-8.062-51.157-8.092Q-51.186-8.121-51.186-8.148L-51.186-8.230Q-51.186-8.265-51.157-8.291Q-51.127-8.316-51.096-8.316L-50.616-8.351Q-50.330-8.351-50.133-8.556Q-49.936-8.761-49.840-9.056Q-49.745-9.351-49.745-9.629Q-49.745-10.008-49.944-10.246Q-50.143-10.484-50.522-10.484Q-50.842-10.484-51.131-10.377Q-51.420-10.269-51.584-10.047Q-51.405-10.047-51.282-9.920Q-51.159-9.793-51.159-9.621Q-51.159-9.449-51.284-9.324Q-51.409-9.199-51.584-9.199Q-51.756-9.199-51.881-9.324Q-52.006-9.449-52.006-9.621Q-52.006-9.988-51.782-10.236Q-51.557-10.484-51.217-10.605Q-50.877-10.726-50.522-10.726Q-50.174-10.726-49.811-10.605Q-49.448-10.484-49.200-10.234Q-48.952-9.984-48.952-9.629Q-48.952-9.144-49.270-8.761Q-49.588-8.379-50.065-8.207Q-49.514-8.097-49.114-7.711Q-48.713-7.324-48.713-6.789Q-48.713-6.332-48.977-5.976Q-49.241-5.621-49.663-5.429Q-50.084-5.238-50.522-5.238Q-50.932-5.238-51.325-5.373Q-51.717-5.508-51.983-5.793Q-52.248-6.078-52.248-6.496Q-52.248-6.691-52.116-6.820Q-51.983-6.949-51.791-6.949Q-51.666-6.949-51.563-6.890Q-51.459-6.832-51.397-6.726Q-51.334-6.621-51.334-6.496Q-51.334-6.301-51.469-6.170Q-51.604-6.039-51.807-6.039",[2711],[2696,6139,6141],{"transform":6140},"translate(66.161 56.638)",[2279,6142],{"d":6143,"fill":2698,"stroke":2698,"className":6144,"style":2748},"M-49.014-5.406L-52.174-5.406L-52.174-5.613Q-52.174-5.640-52.151-5.672L-50.799-7.070Q-50.420-7.457-50.172-7.746Q-49.924-8.035-49.750-8.392Q-49.577-8.750-49.577-9.140Q-49.577-9.488-49.709-9.781Q-49.842-10.074-50.096-10.252Q-50.350-10.429-50.705-10.429Q-51.065-10.429-51.356-10.234Q-51.647-10.039-51.791-9.711L-51.737-9.711Q-51.553-9.711-51.428-9.590Q-51.303-9.468-51.303-9.277Q-51.303-9.097-51.428-8.968Q-51.553-8.840-51.737-8.840Q-51.916-8.840-52.045-8.968Q-52.174-9.097-52.174-9.277Q-52.174-9.679-51.954-10.015Q-51.733-10.351-51.368-10.539Q-51.002-10.726-50.600-10.726Q-50.120-10.726-49.704-10.539Q-49.288-10.351-49.036-9.990Q-48.784-9.629-48.784-9.140Q-48.784-8.781-48.938-8.478Q-49.092-8.176-49.344-7.916Q-49.596-7.656-49.946-7.371Q-50.295-7.086-50.463-6.933L-51.393-6.093L-50.678-6.093Q-49.303-6.093-49.264-6.133Q-49.194-6.211-49.151-6.396Q-49.108-6.582-49.065-6.871L-48.784-6.871",[2711],[2696,6146,6148],{"transform":6147},"translate(134.448 -25.875)",[2279,6149],{"d":6150,"fill":2698,"stroke":2698,"className":6151,"style":2748},"M-51.104-5.629Q-51.104-6.054-51.020-6.504Q-50.936-6.953-50.780-7.371Q-50.623-7.789-50.409-8.176Q-50.194-8.562-49.920-8.918L-49.194-9.871L-50.104-9.871Q-51.600-9.871-51.639-9.832Q-51.709-9.750-51.756-9.560Q-51.803-9.371-51.846-9.093L-52.127-9.093L-51.858-10.812L-51.577-10.812L-51.577-10.789Q-51.577-10.644-51.059-10.601Q-50.541-10.558-50.049-10.558L-48.479-10.558L-48.479-10.367Q-48.487-10.328-48.502-10.301L-49.678-8.765Q-49.979-8.347-50.118-7.840Q-50.256-7.332-50.288-6.838Q-50.319-6.343-50.319-5.629Q-50.319-5.523-50.370-5.431Q-50.420-5.340-50.512-5.289Q-50.604-5.238-50.713-5.238Q-50.819-5.238-50.911-5.289Q-51.002-5.340-51.053-5.431Q-51.104-5.523-51.104-5.629",[2711],[2279,6153],{"fill":2702,"d":6154},"M-40.425-9.972 1.64-25.746",[2279,6156],{"stroke":2702,"d":6157},"m3.512-26.448-3.558-.374 1.685 1.076-.562 1.92",[2696,6159,6161],{"transform":6160},"translate(25.841 -16.403)",[2279,6162],{"d":6136,"fill":2698,"stroke":2698,"className":6163,"style":2748},[2711],[2279,6165],{"fill":2702,"d":6166},"M-40.425-.84 1.64 14.932",[2279,6168],{"stroke":2702,"d":6169},"m3.512 15.635-2.435-2.621.562 1.92-1.685 1.076",[2696,6171,6173],{"transform":6172},"translate(25.841 21.559)",[2279,6174],{"d":6143,"fill":2698,"stroke":2698,"className":6175,"style":2748},[2711],[2696,6177,6178,6181,6184],{"fill":2800,"stroke":2800,"style":2801},[2279,6179],{"fill":2702,"d":6180},"m27.862-26.448 41.502 15.563",[2279,6182],{"stroke":2702,"d":6183},"m71.799-9.972-3.165-3.408.73 2.495-2.19 1.4",[2696,6185,6187],{"transform":6186},"translate(106.623 -16.544)",[2279,6188],{"d":6189,"fill":2800,"stroke":2800,"className":6190,"style":2748},"M-50.120-6.718L-52.362-6.718L-52.362-7.015L-49.791-10.672Q-49.752-10.726-49.690-10.726L-49.545-10.726Q-49.495-10.726-49.463-10.695Q-49.432-10.664-49.432-10.613L-49.432-7.015L-48.600-7.015L-48.600-6.718L-49.432-6.718L-49.432-5.965Q-49.432-5.703-48.608-5.703L-48.608-5.406L-50.944-5.406L-50.944-5.703Q-50.120-5.703-50.120-5.965L-50.120-6.718M-50.065-9.820L-52.034-7.015L-50.065-7.015",[2711],[2279,6192],{"fill":2702,"d":6193},"M27.862 15.635 69.926-.138",[2279,6195],{"stroke":2702,"d":6196},"m71.798-.84-3.557-.375 1.685 1.077-.562 1.919",[2696,6198,6200],{"transform":6199},"translate(106.482 21.559)",[2279,6201],{"d":6202,"fill":2698,"stroke":2698,"className":6203,"style":2748},"M-49.006-5.406L-51.799-5.406L-51.799-5.703Q-50.737-5.703-50.737-5.965L-50.737-10.133Q-51.166-9.918-51.846-9.918L-51.846-10.215Q-50.827-10.215-50.311-10.726L-50.166-10.726Q-50.092-10.707-50.073-10.629L-50.073-5.965Q-50.073-5.703-49.006-5.703",[2711],[3022,6205,6207,6208],{"className":6206},[3025],"one pass in topo order — longest-path values, chosen edge in ",[444,6209,6211],{"className":6210},[447],[444,6212,6214],{"className":6213,"ariaHidden":452},[451],[444,6215,6217,6220,6223],{"className":6216},[456],[444,6218],{"className":6219,"style":544},[460],[444,6221,385],{"className":6222},[465,466],[444,6224,6226],{"className":6225},[465,466],"cc",[381,6228,6229,6230,6245,6246,6299,6300,6316,6317,6299,6368,6384,6385,6403,6404,6419,6420,6423,6424,1911,6439,6454,6455,6470],{},"In the figure, ",[444,6231,6233],{"className":6232},[447],[444,6234,6236],{"className":6235,"ariaHidden":452},[451],[444,6237,6239,6242],{"className":6238},[456],[444,6240],{"className":6241,"style":1295},[460],[444,6243,692],{"className":6244},[465,466]," is reached by ",[444,6247,6249],{"className":6248},[447],[444,6250,6252,6271,6289],{"className":6251,"ariaHidden":452},[451],[444,6253,6255,6259,6262,6265,6268],{"className":6254},[456],[444,6256],{"className":6257,"style":6258},[460],"height:0.7278em;vertical-align:-0.0833em;",[444,6260,3409],{"className":6261},[465],[444,6263],{"className":6264,"style":657},[519],[444,6266,1185],{"className":6267},[1345],[444,6269],{"className":6270,"style":657},[519],[444,6272,6274,6277,6280,6283,6286],{"className":6273},[456],[444,6275],{"className":6276,"style":1127},[460],[444,6278,6072],{"className":6279},[465],[444,6281],{"className":6282,"style":1150},[519],[444,6284,1155],{"className":6285},[1154],[444,6287],{"className":6288,"style":1150},[519],[444,6290,6292,6295],{"className":6291},[456],[444,6293],{"className":6294,"style":1127},[460],[444,6296,6298],{"className":6297},[465],"7"," via ",[444,6301,6303],{"className":6302},[447],[444,6304,6306],{"className":6305,"ariaHidden":452},[451],[444,6307,6309,6312],{"className":6308},[456],[444,6310],{"className":6311,"style":1295},[460],[444,6313,6315],{"className":6314},[465,466],"b"," versus ",[444,6318,6320],{"className":6319},[447],[444,6321,6323,6341,6359],{"className":6322,"ariaHidden":452},[451],[444,6324,6326,6329,6332,6335,6338],{"className":6325},[456],[444,6327],{"className":6328,"style":6258},[460],[444,6330,1794],{"className":6331},[465],[444,6333],{"className":6334,"style":657},[519],[444,6336,1185],{"className":6337},[1345],[444,6339],{"className":6340,"style":657},[519],[444,6342,6344,6347,6350,6353,6356],{"className":6343},[456],[444,6345],{"className":6346,"style":1127},[460],[444,6348,609],{"className":6349},[465],[444,6351],{"className":6352,"style":1150},[519],[444,6354,1155],{"className":6355},[1154],[444,6357],{"className":6358,"style":1150},[519],[444,6360,6362,6365],{"className":6361},[456],[444,6363],{"className":6364,"style":1127},[460],[444,6366,3409],{"className":6367},[465],[444,6369,6371],{"className":6370},[447],[444,6372,6374],{"className":6373,"ariaHidden":452},[451],[444,6375,6377,6380],{"className":6376},[456],[444,6378],{"className":6379,"style":544},[460],[444,6381,6383],{"className":6382},[465,466],"c","; the\n",[444,6386,6388],{"className":6387},[447],[444,6389,6391],{"className":6390,"ariaHidden":452},[451],[444,6392,6394,6397],{"className":6393},[456],[444,6395],{"className":6396,"style":544},[460],[444,6398,6400],{"className":6399},[581],[444,6401,6063],{"className":6402},[465,585]," keeps the through-",[444,6405,6407],{"className":6406},[447],[444,6408,6410],{"className":6409,"ariaHidden":452},[451],[444,6411,6413,6416],{"className":6412},[456],[444,6414],{"className":6415,"style":1295},[460],[444,6417,6315],{"className":6418},[465,466]," edge (in ",[3307,6421,6422],{},"acc","), and because ",[444,6425,6427],{"className":6426},[447],[444,6428,6430],{"className":6429,"ariaHidden":452},[451],[444,6431,6433,6436],{"className":6432},[456],[444,6434],{"className":6435,"style":1295},[460],[444,6437,6315],{"className":6438},[465,466],[444,6440,6442],{"className":6441},[447],[444,6443,6445],{"className":6444,"ariaHidden":452},[451],[444,6446,6448,6451],{"className":6447},[456],[444,6449],{"className":6450,"style":544},[460],[444,6452,6383],{"className":6453},[465,466]," were\nfinalized before ",[444,6456,6458],{"className":6457},[447],[444,6459,6461],{"className":6460,"ariaHidden":452},[451],[444,6462,6464,6467],{"className":6463},[456],[444,6465],{"className":6466,"style":1295},[460],[444,6468,692],{"className":6469},[465,466]," in topological order, one forward sweep settles it.",[381,6472,6473,6476,6477,6480,6481,6514,6515,6561,6562,6631,6632,6635,6636,6639,6640,6643],{},[389,6474,6475],{},"Counting paths"," rides on the same order. To count ",[397,6478,6479],{},"all"," paths ",[444,6482,6484],{"className":6483},[447],[444,6485,6487,6505],{"className":6486,"ariaHidden":452},[451],[444,6488,6490,6493,6496,6499,6502],{"className":6489},[456],[444,6491],{"className":6492,"style":544},[460],[444,6494,3949],{"className":6495},[465,466],[444,6497],{"className":6498,"style":1150},[519],[444,6500,3733],{"className":6501},[1154],[444,6503],{"className":6504,"style":1150},[519],[444,6506,6508,6511],{"className":6507},[456],[444,6509],{"className":6510,"style":3584},[460],[444,6512,3912],{"className":6513},[465,466]," in a\nDAG, set ",[444,6516,6518],{"className":6517},[447],[444,6519,6521,6552],{"className":6520,"ariaHidden":452},[451],[444,6522,6524,6527,6534,6537,6540,6543,6546,6549],{"className":6523},[456],[444,6525],{"className":6526,"style":501},[460],[444,6528,6530],{"className":6529},[465,2226],[444,6531,6533],{"className":6532},[465],"cnt",[444,6535,748],{"className":6536},[505],[444,6538,3949],{"className":6539},[465,466],[444,6541,756],{"className":6542},[529],[444,6544],{"className":6545,"style":1150},[519],[444,6547,1155],{"className":6548},[1154],[444,6550],{"className":6551,"style":1150},[519],[444,6553,6555,6558],{"className":6554},[456],[444,6556],{"className":6557,"style":1127},[460],[444,6559,609],{"className":6560},[465]," and accumulate\n",[444,6563,6565],{"className":6564},[447],[444,6566,6568,6598,6610],{"className":6567,"ariaHidden":452},[451],[444,6569,6571,6574,6580,6583,6586,6589,6592],{"className":6570},[456],[444,6572],{"className":6573,"style":501},[460],[444,6575,6577],{"className":6576},[465,2226],[444,6578,6533],{"className":6579},[465],[444,6581,748],{"className":6582},[505],[444,6584,525],{"className":6585,"style":524},[465,466],[444,6587,756],{"className":6588},[529],[444,6590],{"className":6591,"style":1150},[519],[444,6593,6595],{"className":6594},[1154],[444,6596,1185],{"className":6597},[465],[444,6599,6601,6604,6607],{"className":6600},[456],[444,6602],{"className":6603,"style":3782},[460],[444,6605,1155],{"className":6606},[1154],[444,6608],{"className":6609,"style":1150},[519],[444,6611,6613,6616,6622,6625,6628],{"className":6612},[456],[444,6614],{"className":6615,"style":501},[460],[444,6617,6619],{"className":6618},[465,2226],[444,6620,6533],{"className":6621},[465],[444,6623,748],{"className":6624},[505],[444,6626,510],{"className":6627},[465,466],[444,6629,756],{"className":6630},[529]," over incoming edges in topo order. To\ncount ",[389,6633,6634],{},"shortest"," paths in a weighted graph that may have cycles (",[397,6637,6638],{},"Number of\nWays to Arrive at Destination","), process vertices in ",[389,6641,6642],{},"non-decreasing distance\norder"," (the order Dijkstra finalizes them, which is a topological order of the\nshortest-path DAG) and carry a parallel count:",[444,6645,6647],{"className":6646},[2086],[444,6648,6650],{"className":6649},[447],[444,6651,6653,6687,6723,6756,6786,6798],{"className":6652,"ariaHidden":452},[451],[444,6654,6656,6659,6666,6669,6672,6675,6678,6681,6684],{"className":6655},[456],[444,6657],{"className":6658,"style":501},[460],[444,6660,6662],{"className":6661},[465,2226],[444,6663,6665],{"className":6664},[465],"when ",[444,6667,3886],{"className":6668,"style":3885},[465,466],[444,6670,748],{"className":6671},[505],[444,6673,510],{"className":6674},[465,466],[444,6676,756],{"className":6677},[529],[444,6679],{"className":6680,"style":657},[519],[444,6682,1185],{"className":6683},[1345],[444,6685],{"className":6686,"style":657},[519],[444,6688,6690,6693,6696,6699,6702,6705,6708,6711,6714,6717,6720],{"className":6689},[456],[444,6691],{"className":6692,"style":501},[460],[444,6694,1095],{"className":6695,"style":1094},[465,466],[444,6697,506],{"className":6698},[505],[444,6700,510],{"className":6701},[465,466],[444,6703,515],{"className":6704},[514],[444,6706],{"className":6707,"style":520},[519],[444,6709,525],{"className":6710,"style":524},[465,466],[444,6712,530],{"className":6713},[529],[444,6715],{"className":6716,"style":1150},[519],[444,6718,1155],{"className":6719},[1154],[444,6721],{"className":6722,"style":1150},[519],[444,6724,6726,6729,6732,6735,6738,6741,6744,6747,6750,6753],{"className":6725},[456],[444,6727],{"className":6728,"style":501},[460],[444,6730,3886],{"className":6731,"style":3885},[465,466],[444,6733,748],{"className":6734},[505],[444,6736,525],{"className":6737,"style":524},[465,466],[444,6739,756],{"className":6740},[529],[444,6742],{"className":6743,"style":1150},[519],[444,6745,1721],{"className":6746},[1154],[444,6748,2411],{"className":6749},[519],[444,6751,2411],{"className":6752},[519],[444,6754],{"className":6755,"style":1150},[519],[444,6757,6759,6762,6768,6771,6774,6777,6780],{"className":6758},[456],[444,6760],{"className":6761,"style":501},[460],[444,6763,6765],{"className":6764},[465,2226],[444,6766,6533],{"className":6767},[465],[444,6769,748],{"className":6770},[505],[444,6772,525],{"className":6773,"style":524},[465,466],[444,6775,756],{"className":6776},[529],[444,6778],{"className":6779,"style":1150},[519],[444,6781,6783],{"className":6782},[1154],[444,6784,1185],{"className":6785},[465],[444,6787,6789,6792,6795],{"className":6788},[456],[444,6790],{"className":6791,"style":3782},[460],[444,6793,1155],{"className":6794},[1154],[444,6796],{"className":6797,"style":1150},[519],[444,6799,6801,6804,6810,6813,6816,6819,6823,6826,6833,6841,6847,6850,6853,6857],{"className":6800},[456],[444,6802],{"className":6803,"style":501},[460],[444,6805,6807],{"className":6806},[465,2226],[444,6808,6533],{"className":6809},[465],[444,6811,748],{"className":6812},[505],[444,6814,510],{"className":6815},[465,466],[444,6817,756],{"className":6818},[529],[444,6820],{"className":6821,"style":6822},[519],"margin-right:1em;",[444,6824,506],{"className":6825},[505],[444,6827,6829],{"className":6828},[465,2226],[444,6830,6832],{"className":6831},[465],"a strict improvement instead ",[444,6834,6836],{"className":6835},[465,2226],[444,6837,6840],{"className":6838},[465,6839],"textit","resets ",[444,6842,6844],{"className":6843},[465,2226],[444,6845,6533],{"className":6846},[465],[444,6848,748],{"className":6849},[505],[444,6851,525],{"className":6852,"style":524},[465,466],[444,6854,6856],{"className":6855},[529],"])",[444,6858,1511],{"className":6859},[465],[381,6861,6862],{},"The distance DP finds the best value; the count DP, evaluated in the same order,\ntallies how many ways achieve it.",[2685,6864,6866,7047],{"className":6865},[2688,2689],[2271,6867,6871],{"xmlns":2273,"width":6868,"height":6869,"viewBox":6870},"219.021","190.097","-75 -75 164.266 142.573",[2696,6872,6873,6876,6883,6886,6893,6896,6903,6916,6919,6922,6925,6928,6931,6934,6937,6940,6943,6946,6974,6997,7021],{"stroke":2698,"style":2699},[2279,6874],{"fill":2702,"d":6875},"M-39.796-3.984c0-7.07-5.732-12.803-12.804-12.803-7.071 0-12.803 5.732-12.803 12.803S-59.671 8.82-52.6 8.82s12.804-5.732 12.804-12.804Zm-12.804 0",[2696,6877,6879],{"transform":6878},"translate(-2.154 1.937)",[2279,6880],{"d":6881,"fill":2698,"stroke":2698,"className":6882,"style":6093},"M-51.765-4.533Q-51.545-4.147-50.789-4.147Q-50.491-4.147-50.196-4.248Q-49.902-4.349-49.708-4.562Q-49.515-4.775-49.515-5.083Q-49.515-5.311-49.693-5.458Q-49.871-5.606-50.117-5.658L-50.627-5.755Q-50.842-5.795-51.018-5.918Q-51.194-6.041-51.299-6.227Q-51.405-6.414-51.405-6.630Q-51.405-7.029-51.181-7.335Q-50.956-7.640-50.598-7.801Q-50.240-7.961-49.836-7.961Q-49.572-7.961-49.324-7.882Q-49.076-7.803-48.906-7.623Q-48.737-7.442-48.737-7.179Q-48.737-6.972-48.858-6.814Q-48.979-6.656-49.190-6.656Q-49.313-6.656-49.399-6.737Q-49.484-6.818-49.484-6.937Q-49.484-7.100-49.361-7.234Q-49.238-7.368-49.080-7.368Q-49.168-7.548-49.385-7.625Q-49.603-7.702-49.853-7.702Q-50.095-7.702-50.321-7.614Q-50.548-7.526-50.693-7.357Q-50.838-7.188-50.838-6.937Q-50.838-6.761-50.706-6.643Q-50.574-6.524-50.376-6.476L-49.871-6.379Q-49.484-6.300-49.216-6.030Q-48.948-5.759-48.948-5.377Q-48.948-5.047-49.137-4.727Q-49.326-4.406-49.603-4.208Q-50.104-3.883-50.798-3.883Q-51.110-3.883-51.411-3.969Q-51.712-4.054-51.917-4.252Q-52.121-4.450-52.121-4.757Q-52.121-5.008-51.978-5.192Q-51.835-5.377-51.594-5.377Q-51.440-5.377-51.341-5.285Q-51.242-5.192-51.242-5.047Q-51.242-4.837-51.394-4.685Q-51.545-4.533-51.765-4.533",[2711],[2279,6884],{"fill":2702,"d":6885},"M22.8-35.282c0-7.071-5.732-12.803-12.804-12.803-7.071 0-12.803 5.732-12.803 12.803S2.925-22.478 9.996-22.478 22.8-28.21 22.8-35.282Zm-12.804 0",[2696,6887,6889],{"transform":6888},"translate(60.146 -29.36)",[2279,6890],{"d":6891,"fill":2698,"stroke":2698,"className":6892,"style":6093},"M-50.978-3.883Q-51.374-3.883-51.660-4.087Q-51.945-4.292-52.092-4.626Q-52.240-4.960-52.240-5.351Q-52.240-5.786-52.066-6.247Q-51.892-6.709-51.580-7.100Q-51.268-7.491-50.858-7.726Q-50.447-7.961-50.007-7.961Q-49.739-7.961-49.522-7.823Q-49.304-7.684-49.172-7.438Q-49.133-7.588-49.025-7.684Q-48.917-7.781-48.777-7.781Q-48.654-7.781-48.570-7.708Q-48.487-7.636-48.487-7.513Q-48.487-7.460-48.496-7.429L-49.115-4.938Q-49.172-4.740-49.172-4.542Q-49.172-4.147-48.909-4.147Q-48.623-4.147-48.489-4.470Q-48.355-4.793-48.236-5.298Q-48.227-5.329-48.203-5.353Q-48.179-5.377-48.144-5.377L-48.038-5.377Q-47.990-5.377-47.968-5.344Q-47.946-5.311-47.946-5.263Q-48.060-4.832-48.151-4.579Q-48.241-4.327-48.434-4.105Q-48.627-3.883-48.926-3.883Q-49.234-3.883-49.482-4.054Q-49.730-4.226-49.801-4.516Q-50.056-4.230-50.352-4.057Q-50.649-3.883-50.978-3.883M-50.961-4.147Q-50.631-4.147-50.321-4.388Q-50.012-4.630-49.801-4.946Q-49.792-4.955-49.792-4.973L-49.295-6.937Q-49.352-7.254-49.544-7.478Q-49.735-7.702-50.025-7.702Q-50.394-7.702-50.693-7.383Q-50.992-7.065-51.159-6.656Q-51.295-6.309-51.420-5.799Q-51.545-5.289-51.545-4.964Q-51.545-4.639-51.407-4.393Q-51.268-4.147-50.961-4.147",[2711],[2279,6894],{"fill":2702,"d":6895},"M22.8 27.315c0-7.072-5.732-12.804-12.804-12.804-7.071 0-12.803 5.732-12.803 12.804 0 7.071 5.732 12.803 12.803 12.803S22.8 34.386 22.8 27.315Zm-12.804 0",[2696,6897,6899],{"transform":6898},"translate(60.614 34.423)",[2279,6900],{"d":6901,"fill":2698,"stroke":2698,"className":6902,"style":6093},"M-50.978-3.883Q-51.554-3.883-51.875-4.314Q-52.196-4.744-52.196-5.324Q-52.196-5.729-52.112-5.957L-51.233-9.455Q-51.198-9.605-51.198-9.679Q-51.198-9.816-51.765-9.816Q-51.862-9.816-51.862-9.934Q-51.862-9.991-51.831-10.062Q-51.800-10.132-51.734-10.132L-50.513-10.229Q-50.460-10.229-50.427-10.200Q-50.394-10.171-50.394-10.123L-50.394-10.088L-51.053-7.478Q-50.530-7.961-50.007-7.961Q-49.621-7.961-49.330-7.757Q-49.040-7.552-48.893-7.218Q-48.746-6.884-48.746-6.493Q-48.746-5.909-49.049-5.300Q-49.352-4.692-49.873-4.287Q-50.394-3.883-50.978-3.883M-50.961-4.147Q-50.592-4.147-50.288-4.470Q-49.985-4.793-49.827-5.188Q-49.682-5.544-49.561-6.052Q-49.440-6.559-49.440-6.880Q-49.440-7.205-49.585-7.453Q-49.730-7.702-50.025-7.702Q-50.627-7.702-51.198-6.902L-51.440-5.909Q-51.585-5.285-51.585-5.021Q-51.585-4.678-51.433-4.412Q-51.282-4.147-50.961-4.147",[2711],[2696,6904,6906,6909],{"stroke":2800,"style":6905},"stroke-width:1.2",[2279,6907],{"fill":2702,"d":6908},"M85.396-3.984c0-7.07-5.732-12.803-12.804-12.803-7.071 0-12.803 5.732-12.803 12.803S65.52 8.82 72.592 8.82 85.396 3.088 85.396-3.984Zm-12.804 0",[2696,6910,6912],{"transform":6911},"translate(123.522 2.768)",[2279,6913],{"d":6914,"fill":2800,"stroke":2800,"className":6915,"style":6093},"M-52.016-4.722Q-52.016-4.854-51.989-4.973L-51.339-7.548L-52.284-7.548Q-52.393-7.548-52.393-7.667Q-52.393-7.728-52.360-7.796Q-52.328-7.864-52.266-7.864L-51.268-7.864L-50.908-9.301Q-50.873-9.442-50.761-9.530Q-50.649-9.618-50.513-9.618Q-50.390-9.618-50.306-9.543Q-50.223-9.468-50.223-9.350Q-50.223-9.293-50.231-9.266L-50.583-7.864L-49.656-7.864Q-49.607-7.864-49.579-7.831Q-49.550-7.798-49.550-7.755Q-49.550-7.689-49.583-7.618Q-49.616-7.548-49.673-7.548L-50.658-7.548L-51.312-4.938Q-51.365-4.735-51.365-4.542Q-51.365-4.147-51.106-4.147Q-50.825-4.147-50.594-4.327Q-50.363-4.507-50.192-4.779Q-50.020-5.052-49.919-5.316Q-49.911-5.342-49.889-5.359Q-49.867-5.377-49.836-5.377L-49.730-5.377Q-49.682-5.377-49.660-5.344Q-49.638-5.311-49.638-5.263Q-49.779-4.920-49.990-4.606Q-50.201-4.292-50.486-4.087Q-50.772-3.883-51.123-3.883Q-51.374-3.883-51.576-3.988Q-51.778-4.094-51.897-4.285Q-52.016-4.476-52.016-4.722",[2711],[2279,6917],{"fill":2702,"d":6918},"m-40.97-9.798 37.548-18.774",[2279,6920],{"stroke":2702,"d":6921},"M-1.634-29.467H-5.21l1.789.895-.358 1.967",[2279,6923],{"fill":2702,"d":6924},"m-40.97 1.831 37.548 18.774",[2279,6926],{"stroke":2702,"d":6927},"m-1.634 21.5-2.146-2.862.358 1.967-1.79.895",[2279,6929],{"fill":2702,"d":6930},"M9.996-22.278v34.589",[2279,6932],{"stroke":2702,"d":6933},"m9.996 14.31 1.6-3.199-1.6 1.2-1.6-1.2",[2279,6935],{"fill":2702,"d":6936},"m21.626-29.467 37.19 18.595",[2279,6938],{"stroke":2702,"d":6939},"m60.604-9.977-2.146-2.862.358 1.967-1.789.895",[2279,6941],{"fill":2702,"d":6942},"m21.626 21.5 37.19-18.595",[2279,6944],{"stroke":2702,"d":6945},"M60.604 2.01h-3.577l1.789.895-.358 1.967",[2696,6947,6949,6956,6962,6968],{"stroke":2702,"fontFamily":6948,"fontSize":5131},"cmr8",[2696,6950,6952],{"transform":6951},"translate(-11.215 -21.607)",[2279,6953],{"d":6954,"fill":2698,"stroke":2698,"className":6955,"style":2748},"M-52.319-5.711Q-52.319-6.207-52.069-6.632Q-51.819-7.058-51.399-7.304Q-50.979-7.550-50.479-7.550Q-49.940-7.550-49.549-7.425Q-49.159-7.300-49.159-6.886Q-49.159-6.781-49.209-6.689Q-49.260-6.597-49.352-6.546Q-49.444-6.496-49.553-6.496Q-49.659-6.496-49.750-6.546Q-49.842-6.597-49.893-6.689Q-49.944-6.781-49.944-6.886Q-49.944-7.109-49.776-7.214Q-49.998-7.273-50.471-7.273Q-50.768-7.273-50.983-7.134Q-51.198-6.996-51.329-6.765Q-51.459-6.535-51.518-6.265Q-51.577-5.996-51.577-5.711Q-51.577-5.316-51.444-4.966Q-51.311-4.617-51.039-4.400Q-50.768-4.183-50.370-4.183Q-49.995-4.183-49.719-4.400Q-49.444-4.617-49.342-4.976Q-49.327-5.039-49.264-5.039L-49.159-5.039Q-49.123-5.039-49.098-5.011Q-49.073-4.984-49.073-4.945L-49.073-4.921Q-49.205-4.441-49.590-4.173Q-49.975-3.906-50.479-3.906Q-50.842-3.906-51.176-4.043Q-51.510-4.179-51.770-4.429Q-52.030-4.679-52.174-5.015Q-52.319-5.351-52.319-5.711M-46.655-3.984L-48.510-3.984L-48.510-4.281Q-48.237-4.281-48.069-4.328Q-47.901-4.375-47.901-4.543L-47.901-6.679Q-47.901-6.894-47.963-6.990Q-48.026-7.086-48.145-7.107Q-48.264-7.129-48.510-7.129L-48.510-7.425L-47.319-7.511L-47.319-6.777Q-47.205-6.992-47.012-7.160Q-46.819-7.328-46.580-7.420Q-46.342-7.511-46.088-7.511Q-44.920-7.511-44.920-6.433L-44.920-4.543Q-44.920-4.375-44.750-4.328Q-44.580-4.281-44.311-4.281L-44.311-3.984L-46.166-3.984L-46.166-4.281Q-45.893-4.281-45.725-4.328Q-45.557-4.375-45.557-4.543L-45.557-6.418Q-45.557-6.800-45.678-7.029Q-45.799-7.257-46.151-7.257Q-46.463-7.257-46.717-7.095Q-46.971-6.933-47.118-6.664Q-47.264-6.394-47.264-6.097L-47.264-4.543Q-47.264-4.375-47.094-4.328Q-46.924-4.281-46.655-4.281",[2711],[2696,6957,6958],{"transform":6951},[2279,6959],{"d":6960,"fill":2698,"stroke":2698,"className":6961,"style":2748},"M-43.473-4.945L-43.473-7.136L-44.176-7.136L-44.176-7.390Q-43.820-7.390-43.578-7.623Q-43.336-7.855-43.225-8.203Q-43.113-8.550-43.113-8.906L-42.832-8.906L-42.832-7.433L-41.656-7.433L-41.656-7.136L-42.832-7.136L-42.832-4.961Q-42.832-4.640-42.713-4.412Q-42.594-4.183-42.313-4.183Q-42.133-4.183-42.016-4.306Q-41.898-4.429-41.846-4.609Q-41.793-4.789-41.793-4.961L-41.793-5.433L-41.512-5.433L-41.512-4.945Q-41.512-4.691-41.617-4.451Q-41.723-4.211-41.920-4.058Q-42.117-3.906-42.375-3.906Q-42.691-3.906-42.943-4.029Q-43.195-4.152-43.334-4.386Q-43.473-4.621-43.473-4.945",[2711],[2696,6963,6964],{"transform":6951},[2279,6965],{"d":6966,"fill":2698,"stroke":2698,"className":6967,"style":2748},"M-35.069-4.961L-40.382-4.961Q-40.460-4.968-40.509-5.017Q-40.557-5.066-40.557-5.144Q-40.557-5.214-40.510-5.265Q-40.464-5.316-40.382-5.328L-35.069-5.328Q-34.995-5.316-34.948-5.265Q-34.901-5.214-34.901-5.144Q-34.901-5.066-34.950-5.017Q-34.999-4.968-35.069-4.961M-35.069-6.648L-40.382-6.648Q-40.460-6.656-40.509-6.705Q-40.557-6.754-40.557-6.832Q-40.557-6.902-40.510-6.953Q-40.464-7.004-40.382-7.015L-35.069-7.015Q-34.995-7.004-34.948-6.953Q-34.901-6.902-34.901-6.832Q-34.901-6.754-34.950-6.705Q-34.999-6.656-35.069-6.648",[2711],[2696,6969,6970],{"transform":6951},[2279,6971],{"d":6972,"fill":2698,"stroke":2698,"className":6973,"style":2748},"M-30.825-3.984L-33.618-3.984L-33.618-4.281Q-32.556-4.281-32.556-4.543L-32.556-8.711Q-32.985-8.496-33.665-8.496L-33.665-8.793Q-32.646-8.793-32.130-9.304L-31.985-9.304Q-31.911-9.285-31.892-9.207L-31.892-4.543Q-31.892-4.281-30.825-4.281",[2711],[2696,6975,6976,6982,6987,6992],{"stroke":2702,"fontFamily":6948,"fontSize":5131},[2696,6977,6979],{"transform":6978},"translate(51.38 -52.905)",[2279,6980],{"d":6954,"fill":2698,"stroke":2698,"className":6981,"style":2748},[2711],[2696,6983,6984],{"transform":6978},[2279,6985],{"d":6960,"fill":2698,"stroke":2698,"className":6986,"style":2748},[2711],[2696,6988,6989],{"transform":6978},[2279,6990],{"d":6966,"fill":2698,"stroke":2698,"className":6991,"style":2748},[2711],[2696,6993,6994],{"transform":6978},[2279,6995],{"d":6972,"fill":2698,"stroke":2698,"className":6996,"style":2748},[2711],[2696,6998,6999,7005,7010,7015],{"stroke":2702,"fontFamily":6948,"fontSize":5131},[2696,7000,7002],{"transform":7001},"translate(51.38 58.06)",[2279,7003],{"d":6954,"fill":2698,"stroke":2698,"className":7004,"style":2748},[2711],[2696,7006,7007],{"transform":7001},[2279,7008],{"d":6960,"fill":2698,"stroke":2698,"className":7009,"style":2748},[2711],[2696,7011,7012],{"transform":7001},[2279,7013],{"d":6966,"fill":2698,"stroke":2698,"className":7014,"style":2748},[2711],[2696,7016,7017],{"transform":7001},[2279,7018],{"d":7019,"fill":2698,"stroke":2698,"className":7020,"style":2748},"M-30.833-3.984L-33.993-3.984L-33.993-4.191Q-33.993-4.218-33.970-4.250L-32.618-5.648Q-32.239-6.035-31.991-6.324Q-31.743-6.613-31.569-6.970Q-31.396-7.328-31.396-7.718Q-31.396-8.066-31.528-8.359Q-31.661-8.652-31.915-8.830Q-32.169-9.007-32.524-9.007Q-32.884-9.007-33.175-8.812Q-33.466-8.617-33.610-8.289L-33.556-8.289Q-33.372-8.289-33.247-8.168Q-33.122-8.046-33.122-7.855Q-33.122-7.675-33.247-7.546Q-33.372-7.418-33.556-7.418Q-33.735-7.418-33.864-7.546Q-33.993-7.675-33.993-7.855Q-33.993-8.257-33.773-8.593Q-33.552-8.929-33.187-9.117Q-32.821-9.304-32.419-9.304Q-31.939-9.304-31.523-9.117Q-31.106-8.929-30.855-8.568Q-30.603-8.207-30.603-7.718Q-30.603-7.359-30.757-7.056Q-30.911-6.754-31.163-6.494Q-31.415-6.234-31.765-5.949Q-32.114-5.664-32.282-5.511L-33.212-4.671L-32.497-4.671Q-31.122-4.671-31.083-4.711Q-31.013-4.789-30.970-4.974Q-30.927-5.160-30.884-5.449L-30.603-5.449",[2711],[2696,7022,7023],{"fill":2800,"stroke":2800},[2696,7024,7025,7031,7036,7041],{"fill":2800,"stroke":2702,"fontFamily":6948,"fontSize":5131},[2696,7026,7028],{"transform":7027},"translate(113.976 -24.452)",[2279,7029],{"d":6954,"fill":2800,"stroke":2800,"className":7030,"style":2748},[2711],[2696,7032,7033],{"transform":7027},[2279,7034],{"d":6960,"fill":2800,"stroke":2800,"className":7035,"style":2748},[2711],[2696,7037,7038],{"transform":7027},[2279,7039],{"d":6966,"fill":2800,"stroke":2800,"className":7040,"style":2748},[2711],[2696,7042,7043],{"transform":7027},[2279,7044],{"d":7045,"fill":2800,"stroke":2800,"className":7046,"style":2748},"M-33.626-4.617Q-33.435-4.343-33.079-4.216Q-32.724-4.089-32.341-4.089Q-32.005-4.089-31.796-4.275Q-31.587-4.461-31.491-4.754Q-31.396-5.046-31.396-5.359Q-31.396-5.683-31.493-5.978Q-31.591-6.273-31.804-6.457Q-32.017-6.640-32.349-6.640L-32.915-6.640Q-32.946-6.640-32.976-6.670Q-33.005-6.699-33.005-6.726L-33.005-6.808Q-33.005-6.843-32.976-6.869Q-32.946-6.894-32.915-6.894L-32.435-6.929Q-32.149-6.929-31.952-7.134Q-31.755-7.339-31.659-7.634Q-31.564-7.929-31.564-8.207Q-31.564-8.586-31.763-8.824Q-31.962-9.062-32.341-9.062Q-32.661-9.062-32.950-8.955Q-33.239-8.847-33.403-8.625Q-33.224-8.625-33.101-8.498Q-32.978-8.371-32.978-8.199Q-32.978-8.027-33.103-7.902Q-33.228-7.777-33.403-7.777Q-33.575-7.777-33.700-7.902Q-33.825-8.027-33.825-8.199Q-33.825-8.566-33.601-8.814Q-33.376-9.062-33.036-9.183Q-32.696-9.304-32.341-9.304Q-31.993-9.304-31.630-9.183Q-31.267-9.062-31.019-8.812Q-30.771-8.562-30.771-8.207Q-30.771-7.722-31.089-7.339Q-31.407-6.957-31.884-6.785Q-31.333-6.675-30.933-6.289Q-30.532-5.902-30.532-5.367Q-30.532-4.910-30.796-4.554Q-31.060-4.199-31.481-4.007Q-31.903-3.816-32.341-3.816Q-32.751-3.816-33.144-3.951Q-33.536-4.086-33.802-4.371Q-34.067-4.656-34.067-5.074Q-34.067-5.269-33.935-5.398Q-33.802-5.527-33.610-5.527Q-33.485-5.527-33.382-5.468Q-33.278-5.410-33.216-5.304Q-33.153-5.199-33.153-5.074Q-33.153-4.879-33.288-4.748Q-33.423-4.617-33.626-4.617",[2711],[3022,7048,7050,7051,7084,7085,7130,7131,7200,7201],{"className":7049},[3025],"Counting ",[444,7052,7054],{"className":7053},[447],[444,7055,7057,7075],{"className":7056,"ariaHidden":452},[451],[444,7058,7060,7063,7066,7069,7072],{"className":7059},[456],[444,7061],{"className":7062,"style":544},[460],[444,7064,3949],{"className":7065},[465,466],[444,7067],{"className":7068,"style":1150},[519],[444,7070,3733],{"className":7071},[1154],[444,7073],{"className":7074,"style":1150},[519],[444,7076,7078,7081],{"className":7077},[456],[444,7079],{"className":7080,"style":3584},[460],[444,7082,3912],{"className":7083},[465,466]," paths in topo order: ",[444,7086,7088],{"className":7087},[447],[444,7089,7091,7121],{"className":7090,"ariaHidden":452},[451],[444,7092,7094,7097,7103,7106,7109,7112,7115,7118],{"className":7093},[456],[444,7095],{"className":7096,"style":501},[460],[444,7098,7100],{"className":7099},[465,2226],[444,7101,6533],{"className":7102},[465],[444,7104,748],{"className":7105},[505],[444,7107,3949],{"className":7108},[465,466],[444,7110,756],{"className":7111},[529],[444,7113],{"className":7114,"style":1150},[519],[444,7116,1155],{"className":7117},[1154],[444,7119],{"className":7120,"style":1150},[519],[444,7122,7124,7127],{"className":7123},[456],[444,7125],{"className":7126,"style":1127},[460],[444,7128,609],{"className":7129},[465],", then ",[444,7132,7134],{"className":7133},[447],[444,7135,7137,7167,7179],{"className":7136,"ariaHidden":452},[451],[444,7138,7140,7143,7149,7152,7155,7158,7161],{"className":7139},[456],[444,7141],{"className":7142,"style":501},[460],[444,7144,7146],{"className":7145},[465,2226],[444,7147,6533],{"className":7148},[465],[444,7150,748],{"className":7151},[505],[444,7153,525],{"className":7154,"style":524},[465,466],[444,7156,756],{"className":7157},[529],[444,7159],{"className":7160,"style":1150},[519],[444,7162,7164],{"className":7163},[1154],[444,7165,1185],{"className":7166},[465],[444,7168,7170,7173,7176],{"className":7169},[456],[444,7171],{"className":7172,"style":3782},[460],[444,7174,1155],{"className":7175},[1154],[444,7177],{"className":7178,"style":1150},[519],[444,7180,7182,7185,7191,7194,7197],{"className":7181},[456],[444,7183],{"className":7184,"style":501},[460],[444,7186,7188],{"className":7187},[465,2226],[444,7189,6533],{"className":7190},[465],[444,7192,748],{"className":7193},[505],[444,7195,510],{"className":7196},[465,466],[444,7198,756],{"className":7199},[529]," over incoming edges — here ",[444,7202,7204],{"className":7203},[447],[444,7205,7207,7237,7255,7273],{"className":7206,"ariaHidden":452},[451],[444,7208,7210,7213,7219,7222,7225,7228,7231,7234],{"className":7209},[456],[444,7211],{"className":7212,"style":501},[460],[444,7214,7216],{"className":7215},[465,2226],[444,7217,6533],{"className":7218},[465],[444,7220,748],{"className":7221},[505],[444,7223,3912],{"className":7224},[465,466],[444,7226,756],{"className":7227},[529],[444,7229],{"className":7230,"style":1150},[519],[444,7232,1155],{"className":7233},[1154],[444,7235],{"className":7236,"style":1150},[519],[444,7238,7240,7243,7246,7249,7252],{"className":7239},[456],[444,7241],{"className":7242,"style":6258},[460],[444,7244,609],{"className":7245},[465],[444,7247],{"className":7248,"style":657},[519],[444,7250,1185],{"className":7251},[1345],[444,7253],{"className":7254,"style":657},[519],[444,7256,7258,7261,7264,7267,7270],{"className":7257},[456],[444,7259],{"className":7260,"style":1127},[460],[444,7262,1794],{"className":7263},[465],[444,7265],{"className":7266,"style":1150},[519],[444,7268,1155],{"className":7269},[1154],[444,7271],{"className":7272,"style":1150},[519],[444,7274,7276,7279],{"className":7275},[456],[444,7277],{"className":7278,"style":1127},[460],[444,7280,3409],{"className":7281},[465],[611,7283,7285],{"id":7284},"warshalls-transitive-closure-the-boolean-analog","Warshall's transitive closure: the boolean analog",[381,7287,7288,7289,7292,7293,595,7300,7328,7329,7352,7353,7356,7357,7428,7429,7444,7445,7460,7461,1721],{},"Replace ",[421,7290,7291],{},"shortest distance"," with ",[421,7294,7295,7296,7299],{},"is there ",[397,7297,7298],{},"any"," path",[444,7301,7303],{"className":7302},[447],[444,7304,7306],{"className":7305,"ariaHidden":452},[451],[444,7307,7309,7312,7318,7321,7325],{"className":7308},[456],[444,7310],{"className":7311,"style":501},[460],[444,7313,7315],{"className":7314},[581],[444,7316,586],{"className":7317},[465,585],[444,7319],{"className":7320,"style":520},[519],[444,7322,7324],{"className":7323},[465],"\u002F",[444,7326,1185],{"className":7327},[465]," with\n",[444,7330,7332],{"className":7331},[447],[444,7333,7335],{"className":7334,"ariaHidden":452},[451],[444,7336,7338,7341,7345,7348],{"className":7337},[456],[444,7339],{"className":7340,"style":501},[460],[444,7342,7344],{"className":7343},[465],"∨",[444,7346,7324],{"className":7347},[465],[444,7349,7351],{"className":7350},[465],"∧",", and Floyd–Warshall becomes ",[389,7354,7355],{},"Warshall's transitive-closure","\nalgorithm. Let ",[444,7358,7360],{"className":7359},[447],[444,7361,7363],{"className":7362,"ariaHidden":452},[451],[444,7364,7366,7369,7410,7413,7416,7419,7422,7425],{"className":7365},[456],[444,7367],{"className":7368,"style":501},[460],[444,7370,7372,7376],{"className":7371},[465],[444,7373,7375],{"className":7374,"style":3885},[465,466],"r",[444,7377,7379],{"className":7378},[696],[444,7380,7382,7402],{"className":7381},[700,701],[444,7383,7385,7399],{"className":7384},[705],[444,7386,7388],{"className":7387,"style":710},[709],[444,7389,7390,7393],{"style":3902},[444,7391],{"className":7392,"style":718},[717],[444,7394,7396],{"className":7395},[722,723,724,725],[444,7397,730],{"className":7398,"style":729},[465,466,725],[444,7400,735],{"className":7401},[734],[444,7403,7405],{"className":7404},[705],[444,7406,7408],{"className":7407,"style":742},[709],[444,7409],{},[444,7411,748],{"className":7412},[505],[444,7414,752],{"className":7415},[465,466],[444,7417,756],{"className":7418},[529],[444,7420,748],{"className":7421},[505],[444,7423,764],{"className":7424,"style":763},[465,466],[444,7426,756],{"className":7427},[529]," be true iff ",[444,7430,7432],{"className":7431},[447],[444,7433,7435],{"className":7434,"ariaHidden":452},[451],[444,7436,7438,7441],{"className":7437},[456],[444,7439],{"className":7440,"style":798},[460],[444,7442,764],{"className":7443,"style":763},[465,466]," is reachable from ",[444,7446,7448],{"className":7447},[447],[444,7449,7451],{"className":7450,"ariaHidden":452},[451],[444,7452,7454,7457],{"className":7453},[456],[444,7455],{"className":7456,"style":781},[460],[444,7458,752],{"className":7459},[465,466]," using\nintermediate vertices in ",[444,7462,7464],{"className":7463},[447],[444,7465,7467],{"className":7466,"ariaHidden":452},[451],[444,7468,7470,7473,7476,7479,7482,7485,7488,7491,7494,7497,7500],{"className":7469},[456],[444,7471],{"className":7472,"style":501},[460],[444,7474,822],{"className":7475},[505],[444,7477,609],{"className":7478},[465],[444,7480,515],{"className":7481},[514],[444,7483],{"className":7484,"style":520},[519],[444,7486,644],{"className":7487},[643],[444,7489],{"className":7490,"style":520},[519],[444,7492,515],{"className":7493},[514],[444,7495],{"className":7496,"style":520},[519],[444,7498,730],{"className":7499,"style":729},[465,466],[444,7501,850],{"className":7502},[529],[444,7504,7506],{"className":7505},[2086],[444,7507,7509],{"className":7508},[447],[444,7510,7512,7585,7673,7768],{"className":7511,"ariaHidden":452},[451],[444,7513,7515,7518,7558,7561,7564,7567,7570,7573,7576,7579,7582],{"className":7514},[456],[444,7516],{"className":7517,"style":501},[460],[444,7519,7521,7524],{"className":7520},[465],[444,7522,7375],{"className":7523,"style":3885},[465,466],[444,7525,7527],{"className":7526},[696],[444,7528,7530,7550],{"className":7529},[700,701],[444,7531,7533,7547],{"className":7532},[705],[444,7534,7536],{"className":7535,"style":710},[709],[444,7537,7538,7541],{"style":3902},[444,7539],{"className":7540,"style":718},[717],[444,7542,7544],{"className":7543},[722,723,724,725],[444,7545,730],{"className":7546,"style":729},[465,466,725],[444,7548,735],{"className":7549},[734],[444,7551,7553],{"className":7552},[705],[444,7554,7556],{"className":7555,"style":742},[709],[444,7557],{},[444,7559,748],{"className":7560},[505],[444,7562,752],{"className":7563},[465,466],[444,7565,756],{"className":7566},[529],[444,7568,748],{"className":7569},[505],[444,7571,764],{"className":7572,"style":763},[465,466],[444,7574,756],{"className":7575},[529],[444,7577],{"className":7578,"style":1150},[519],[444,7580,1155],{"className":7581},[1154],[444,7583],{"className":7584,"style":1150},[519],[444,7586,7588,7591,7640,7643,7646,7649,7652,7655,7658,7661,7664,7667,7670],{"className":7587},[456],[444,7589],{"className":7590,"style":501},[460],[444,7592,7594,7597],{"className":7593},[465],[444,7595,7375],{"className":7596,"style":3885},[465,466],[444,7598,7600],{"className":7599},[696],[444,7601,7603,7632],{"className":7602},[700,701],[444,7604,7606,7629],{"className":7605},[705],[444,7607,7609],{"className":7608,"style":710},[709],[444,7610,7611,7614],{"style":3902},[444,7612],{"className":7613,"style":718},[717],[444,7615,7617],{"className":7616},[722,723,724,725],[444,7618,7620,7623,7626],{"className":7619},[465,725],[444,7621,730],{"className":7622,"style":729},[465,466,725],[444,7624,1346],{"className":7625},[1345,725],[444,7627,609],{"className":7628},[465,725],[444,7630,735],{"className":7631},[734],[444,7633,7635],{"className":7634},[705],[444,7636,7638],{"className":7637,"style":2357},[709],[444,7639],{},[444,7641,748],{"className":7642},[505],[444,7644,752],{"className":7645},[465,466],[444,7647,756],{"className":7648},[529],[444,7650,748],{"className":7651},[505],[444,7653,764],{"className":7654,"style":763},[465,466],[444,7656,756],{"className":7657},[529],[444,7659,2411],{"className":7660},[519],[444,7662],{"className":7663,"style":657},[519],[444,7665,7344],{"className":7666},[1345],[444,7668,2411],{"className":7669},[519],[444,7671],{"className":7672,"style":657},[519],[444,7674,7676,7680,7686,7735,7738,7741,7744,7747,7750,7753,7756,7759,7762,7765],{"className":7675},[456],[444,7677],{"className":7678,"style":7679},[460],"height:1.2em;vertical-align:-0.35em;",[444,7681,7683],{"className":7682},[465],[444,7684,506],{"className":7685},[2188,2189],[444,7687,7689,7692],{"className":7688},[465],[444,7690,7375],{"className":7691,"style":3885},[465,466],[444,7693,7695],{"className":7694},[696],[444,7696,7698,7727],{"className":7697},[700,701],[444,7699,7701,7724],{"className":7700},[705],[444,7702,7704],{"className":7703,"style":710},[709],[444,7705,7706,7709],{"style":3902},[444,7707],{"className":7708,"style":718},[717],[444,7710,7712],{"className":7711},[722,723,724,725],[444,7713,7715,7718,7721],{"className":7714},[465,725],[444,7716,730],{"className":7717,"style":729},[465,466,725],[444,7719,1346],{"className":7720},[1345,725],[444,7722,609],{"className":7723},[465,725],[444,7725,735],{"className":7726},[734],[444,7728,7730],{"className":7729},[705],[444,7731,7733],{"className":7732,"style":2357},[709],[444,7734],{},[444,7736,748],{"className":7737},[505],[444,7739,752],{"className":7740},[465,466],[444,7742,756],{"className":7743},[529],[444,7745,748],{"className":7746},[505],[444,7748,730],{"className":7749,"style":729},[465,466],[444,7751,756],{"className":7752},[529],[444,7754,2411],{"className":7755},[519],[444,7757],{"className":7758,"style":657},[519],[444,7760,7351],{"className":7761},[1345],[444,7763,2411],{"className":7764},[519],[444,7766],{"className":7767,"style":657},[519],[444,7769,7771,7774,7823,7826,7829,7832,7835,7838,7841,7847],{"className":7770},[456],[444,7772],{"className":7773,"style":7679},[460],[444,7775,7777,7780],{"className":7776},[465],[444,7778,7375],{"className":7779,"style":3885},[465,466],[444,7781,7783],{"className":7782},[696],[444,7784,7786,7815],{"className":7785},[700,701],[444,7787,7789,7812],{"className":7788},[705],[444,7790,7792],{"className":7791,"style":710},[709],[444,7793,7794,7797],{"style":3902},[444,7795],{"className":7796,"style":718},[717],[444,7798,7800],{"className":7799},[722,723,724,725],[444,7801,7803,7806,7809],{"className":7802},[465,725],[444,7804,730],{"className":7805,"style":729},[465,466,725],[444,7807,1346],{"className":7808},[1345,725],[444,7810,609],{"className":7811},[465,725],[444,7813,735],{"className":7814},[734],[444,7816,7818],{"className":7817},[705],[444,7819,7821],{"className":7820,"style":2357},[709],[444,7822],{},[444,7824,748],{"className":7825},[505],[444,7827,730],{"className":7828,"style":729},[465,466],[444,7830,756],{"className":7831},[529],[444,7833,748],{"className":7834},[505],[444,7836,764],{"className":7837,"style":763},[465,466],[444,7839,756],{"className":7840},[529],[444,7842,7844],{"className":7843},[465],[444,7845,530],{"className":7846},[2188,2189],[444,7848,1511],{"className":7849},[465],[381,7851,7852,7853,7903,7904,7919,7920,7923,7924,7959,7960,1511],{},"Same triple loop, same ",[444,7854,7856],{"className":7855},[447],[444,7857,7859],{"className":7858,"ariaHidden":452},[451],[444,7860,7862,7865,7868,7871,7900],{"className":7861},[456],[444,7863],{"className":7864,"style":3370},[460],[444,7866,4878],{"className":7867,"style":3885},[465,466],[444,7869,506],{"className":7870},[505],[444,7872,7874,7877],{"className":7873},[465],[444,7875,658],{"className":7876,"style":657},[465,466],[444,7878,7880],{"className":7879},[696],[444,7881,7883],{"className":7882},[700],[444,7884,7886],{"className":7885},[705],[444,7887,7889],{"className":7888,"style":3396},[709],[444,7890,7891,7894],{"style":3399},[444,7892],{"className":7893,"style":718},[717],[444,7895,7897],{"className":7896},[722,723,724,725],[444,7898,3409],{"className":7899},[465,725],[444,7901,530],{"className":7902},[529],", same in-place collapse of the ",[444,7905,7907],{"className":7906},[447],[444,7908,7910],{"className":7909,"ariaHidden":452},[451],[444,7911,7913,7916],{"className":7912},[456],[444,7914],{"className":7915,"style":1295},[460],[444,7917,730],{"className":7918,"style":729},[465,466]," index; only\nthe semiring changed (booleans under or\u002Fand instead of reals under min\u002Fplus).\n",[397,7921,7922],{},"Course Schedule IV"," is this exactly: prerequisites form a DAG, and each query\n",[421,7925,7926,7927,7942,7943,7958],{},"is course ",[444,7928,7930],{"className":7929},[447],[444,7931,7933],{"className":7932,"ariaHidden":452},[451],[444,7934,7936,7939],{"className":7935},[456],[444,7937],{"className":7938,"style":544},[460],[444,7940,385],{"className":7941},[465,466]," a prerequisite of course ",[444,7944,7946],{"className":7945},[447],[444,7947,7949],{"className":7948,"ariaHidden":452},[451],[444,7950,7952,7955],{"className":7951},[456],[444,7953],{"className":7954,"style":1295},[460],[444,7956,6315],{"className":7957},[465,466],"?"," is a lookup in the reachability\nmatrix ",[444,7961,7963],{"className":7962},[447],[444,7964,7966],{"className":7965,"ariaHidden":452},[451],[444,7967,7969,7973],{"className":7968},[456],[444,7970],{"className":7971,"style":7972},[460],"height:0.5806em;vertical-align:-0.15em;",[444,7974,7976,7979],{"className":7975},[465],[444,7977,7375],{"className":7978,"style":3885},[465,466],[444,7980,7982],{"className":7981},[696],[444,7983,7985,8005],{"className":7984},[700,701],[444,7986,7988,8002],{"className":7987},[705],[444,7989,7991],{"className":7990,"style":907},[709],[444,7992,7993,7996],{"style":3902},[444,7994],{"className":7995,"style":718},[717],[444,7997,7999],{"className":7998},[722,723,724,725],[444,8000,658],{"className":8001,"style":657},[465,466,725],[444,8003,735],{"className":8004},[734],[444,8006,8008],{"className":8007},[705],[444,8009,8011],{"className":8010,"style":742},[709],[444,8012],{},[611,8014,8016],{"id":8015},"heldkarp-a-subset-as-the-resource","Held–Karp: a subset as the resource",[381,8018,8019,8020,8023,8024,8026,8027,8061,8062,8077,8078,8093,8094,8290,8291,8294,8295,8337,8338,8353,8354,8357,8358,8392],{},"The resource need not be a single number. In ",[389,8021,8022],{},"Held–Karp"," bitmask TSP (the\n",[385,8025,271],{"href":272}," lesson), the subproblem\nis ",[444,8028,8030],{"className":8029},[447],[444,8031,8033],{"className":8032,"ariaHidden":452},[451],[444,8034,8036,8039,8042,8045,8049,8052,8055,8058],{"className":8035},[456],[444,8037],{"className":8038,"style":501},[460],[444,8040,3886],{"className":8041,"style":3885},[465,466],[444,8043,748],{"className":8044},[505],[444,8046,8048],{"className":8047,"style":4496},[465,466],"S",[444,8050,756],{"className":8051},[529],[444,8053,748],{"className":8054},[505],[444,8056,525],{"className":8057,"style":524},[465,466],[444,8059,756],{"className":8060},[529]," = the cheapest path starting at the origin, visiting exactly the\nvertex set ",[444,8063,8065],{"className":8064},[447],[444,8066,8068],{"className":8067,"ariaHidden":452},[451],[444,8069,8071,8074],{"className":8070},[456],[444,8072],{"className":8073,"style":461},[460],[444,8075,8048],{"className":8076,"style":4496},[465,466],", and ending at ",[444,8079,8081],{"className":8080},[447],[444,8082,8084],{"className":8083,"ariaHidden":452},[451],[444,8085,8087,8090],{"className":8086},[456],[444,8088],{"className":8089,"style":544},[460],[444,8091,525],{"className":8092,"style":524},[465,466],"; the transition relaxes over the last hop\n",[444,8095,8097],{"className":8096},[447],[444,8098,8100,8136,8229,8263],{"className":8099,"ariaHidden":452},[451],[444,8101,8103,8106,8109,8112,8115,8118,8121,8124,8127,8130,8133],{"className":8102},[456],[444,8104],{"className":8105,"style":501},[460],[444,8107,3886],{"className":8108,"style":3885},[465,466],[444,8110,748],{"className":8111},[505],[444,8113,8048],{"className":8114,"style":4496},[465,466],[444,8116,756],{"className":8117},[529],[444,8119,748],{"className":8120},[505],[444,8122,525],{"className":8123,"style":524},[465,466],[444,8125,756],{"className":8126},[529],[444,8128],{"className":8129,"style":1150},[519],[444,8131,1155],{"className":8132},[1154],[444,8134],{"className":8135,"style":1150},[519],[444,8137,8139,8143,8208,8211,8214,8217,8220,8223,8226],{"className":8138},[456],[444,8140],{"className":8141,"style":8142},[460],"height:1.1052em;vertical-align:-0.3552em;",[444,8144,8146,8152],{"className":8145},[581],[444,8147,8149],{"className":8148},[581],[444,8150,586],{"className":8151},[465,585],[444,8153,8155],{"className":8154},[696],[444,8156,8158,8200],{"className":8157},[700,701],[444,8159,8161,8197],{"className":8160},[705],[444,8162,8164],{"className":8163,"style":4461},[709],[444,8165,8166,8169],{"style":4464},[444,8167],{"className":8168,"style":718},[717],[444,8170,8172],{"className":8171},[722,723,724,725],[444,8173,8175,8178,8181,8184,8188,8191,8194],{"className":8174},[465,725],[444,8176,510],{"className":8177},[465,466,725],[444,8179,4492],{"className":8180},[1154,725],[444,8182,8048],{"className":8183,"style":4496},[465,466,725],[444,8185,8187],{"className":8186},[1345,725],"∖",[444,8189,822],{"className":8190},[505,725],[444,8192,525],{"className":8193,"style":524},[465,466,725],[444,8195,850],{"className":8196},[529,725],[444,8198,735],{"className":8199},[734],[444,8201,8203],{"className":8202},[705],[444,8204,8206],{"className":8205,"style":4507},[709],[444,8207],{},[444,8209],{"className":8210,"style":520},[519],[444,8212,3886],{"className":8213,"style":3885},[465,466],[444,8215,748],{"className":8216},[505],[444,8218,8048],{"className":8219,"style":4496},[465,466],[444,8221],{"className":8222,"style":657},[519],[444,8224,8187],{"className":8225},[1345],[444,8227],{"className":8228,"style":657},[519],[444,8230,8232,8235,8238,8241,8245,8248,8251,8254,8257,8260],{"className":8231},[456],[444,8233],{"className":8234,"style":501},[460],[444,8236,822],{"className":8237},[505],[444,8239,525],{"className":8240,"style":524},[465,466],[444,8242,8244],{"className":8243},[529],"}]",[444,8246,748],{"className":8247},[505],[444,8249,510],{"className":8250},[465,466],[444,8252,756],{"className":8253},[529],[444,8255],{"className":8256,"style":657},[519],[444,8258,1185],{"className":8259},[1345],[444,8261],{"className":8262,"style":657},[519],[444,8264,8266,8269,8272,8275,8278,8281,8284,8287],{"className":8265},[456],[444,8267],{"className":8268,"style":501},[460],[444,8270,1095],{"className":8271,"style":1094},[465,466],[444,8273,506],{"className":8274},[505],[444,8276,510],{"className":8277},[465,466],[444,8279,515],{"className":8280},[514],[444,8282],{"className":8283,"style":520},[519],[444,8285,525],{"className":8286,"style":524},[465,466],[444,8288,530],{"className":8289},[529],". The\nrationed resource is the ",[389,8292,8293],{},"subset of visited vertices",", grown one vertex per\nlayer, the same skeleton as Floyd–Warshall, with ",[444,8296,8298],{"className":8297},[447],[444,8299,8301],{"className":8300,"ariaHidden":452},[451],[444,8302,8304,8308],{"className":8303},[456],[444,8305],{"className":8306,"style":8307},[460],"height:0.8413em;",[444,8309,8311,8314],{"className":8310},[465],[444,8312,1794],{"className":8313},[465],[444,8315,8317],{"className":8316},[696],[444,8318,8320],{"className":8319},[700],[444,8321,8323],{"className":8322},[705],[444,8324,8326],{"className":8325,"style":8307},[709],[444,8327,8328,8331],{"style":3399},[444,8329],{"className":8330,"style":718},[717],[444,8332,8334],{"className":8333},[722,723,724,725],[444,8335,658],{"className":8336,"style":657},[465,466,725]," subsets in place of ",[444,8339,8341],{"className":8340},[447],[444,8342,8344],{"className":8343,"ariaHidden":452},[451],[444,8345,8347,8350],{"className":8346},[456],[444,8348],{"className":8349,"style":461},[460],[444,8351,658],{"className":8352,"style":657},[465,466],"\nintermediate-vertex levels. ",[397,8355,8356],{},"Shortest Path Visiting All Nodes"," is the unweighted\ncousin: a BFS over ",[444,8359,8361],{"className":8360},[447],[444,8362,8364],{"className":8363,"ariaHidden":452},[451],[444,8365,8367,8370,8373,8380,8383,8386,8389],{"className":8366},[456],[444,8368],{"className":8369,"style":501},[460],[444,8371,506],{"className":8372},[505],[444,8374,8376],{"className":8375},[465,2226],[444,8377,8379],{"className":8378},[465],"mask",[444,8381,515],{"className":8382},[514],[444,8384],{"className":8385,"style":520},[519],[444,8387,525],{"className":8388,"style":524},[465,466],[444,8390,530],{"className":8391},[529]," states, where the mask is again the\nresource. The DP-on-graphs lens scales from one scalar of slack all the way up to\nan exponential subset.",[611,8394,8396],{"id":8395},"choosing-the-framing","Choosing the framing",[381,8398,8399],{},"All four are DP, but the right resource depends on the graph:",[426,8401,8402,8513,8712,8769],{},[429,8403,8404,8407,8408,8458,8459,8509,8510,8512],{},[389,8405,8406],{},"Floyd–Warshall",": dense, all-pairs, negative edges allowed; ",[444,8409,8411],{"className":8410},[447],[444,8412,8414],{"className":8413,"ariaHidden":452},[451],[444,8415,8417,8420,8423,8426,8455],{"className":8416},[456],[444,8418],{"className":8419,"style":3370},[460],[444,8421,4878],{"className":8422,"style":3885},[465,466],[444,8424,506],{"className":8425},[505],[444,8427,8429,8432],{"className":8428},[465],[444,8430,658],{"className":8431,"style":657},[465,466],[444,8433,8435],{"className":8434},[696],[444,8436,8438],{"className":8437},[700],[444,8439,8441],{"className":8440},[705],[444,8442,8444],{"className":8443,"style":3396},[709],[444,8445,8446,8449],{"style":3399},[444,8447],{"className":8448,"style":718},[717],[444,8450,8452],{"className":8451},[722,723,724,725],[444,8453,3409],{"className":8454},[465,725],[444,8456,530],{"className":8457},[529]," time,\n",[444,8460,8462],{"className":8461},[447],[444,8463,8465],{"className":8464,"ariaHidden":452},[451],[444,8466,8468,8471,8474,8477,8506],{"className":8467},[456],[444,8469],{"className":8470,"style":3370},[460],[444,8472,4878],{"className":8473,"style":3885},[465,466],[444,8475,506],{"className":8476},[505],[444,8478,8480,8483],{"className":8479},[465],[444,8481,658],{"className":8482,"style":657},[465,466],[444,8484,8486],{"className":8485},[696],[444,8487,8489],{"className":8488},[700],[444,8490,8492],{"className":8491},[705],[444,8493,8495],{"className":8494,"style":3396},[709],[444,8496,8497,8500],{"style":3399},[444,8498],{"className":8499,"style":718},[717],[444,8501,8503],{"className":8502},[722,723,724,725],[444,8504,1794],{"className":8505},[465,725],[444,8507,530],{"className":8508},[529]," space. The default when you need ",[397,8511,3471],{}," pair.",[429,8514,8515,8537,8538,8541,8542,8608,8609,8650,8651,1511],{},[389,8516,8517,8536],{},[444,8518,8520],{"className":8519},[447],[444,8521,8523],{"className":8522,"ariaHidden":452},[451],[444,8524,8526,8529,8532],{"className":8525},[456],[444,8527],{"className":8528,"style":4651},[460],[444,8530,658],{"className":8531,"style":657},[465,466],[444,8533,8535],{"className":8534},[465],"×"," Dijkstra",": sparse graphs with ",[389,8539,8540],{},"non-negative"," weights;\n",[444,8543,8545],{"className":8544},[447],[444,8546,8548,8578],{"className":8547,"ariaHidden":452},[451],[444,8549,8551,8554,8557,8560,8563,8566,8569,8572,8575],{"className":8550},[456],[444,8552],{"className":8553,"style":501},[460],[444,8555,4878],{"className":8556,"style":3885},[465,466],[444,8558,506],{"className":8559},[505],[444,8561,658],{"className":8562,"style":657},[465,466],[444,8564,506],{"className":8565},[505],[444,8567,4497],{"className":8568,"style":4496},[465,466],[444,8570],{"className":8571,"style":657},[519],[444,8573,1185],{"className":8574},[1345],[444,8576],{"className":8577,"style":657},[519],[444,8579,8581,8584,8587,8590,8598,8601,8604],{"className":8580},[456],[444,8582],{"className":8583,"style":501},[460],[444,8585,658],{"className":8586,"style":657},[465,466],[444,8588],{"className":8589,"style":520},[519],[444,8591,8593],{"className":8592},[581],[444,8594,8597],{"className":8595,"style":8596},[465,585],"margin-right:0.0139em;","log",[444,8599],{"className":8600,"style":520},[519],[444,8602,658],{"className":8603,"style":657},[465,466],[444,8605,8607],{"className":8606},[529],"))",", which beats ",[444,8610,8612],{"className":8611},[447],[444,8613,8615],{"className":8614,"ariaHidden":452},[451],[444,8616,8618,8621],{"className":8617},[456],[444,8619],{"className":8620,"style":3396},[460],[444,8622,8624,8627],{"className":8623},[465],[444,8625,658],{"className":8626,"style":657},[465,466],[444,8628,8630],{"className":8629},[696],[444,8631,8633],{"className":8632},[700],[444,8634,8636],{"className":8635},[705],[444,8637,8639],{"className":8638,"style":3396},[709],[444,8640,8641,8644],{"style":3399},[444,8642],{"className":8643,"style":718},[717],[444,8645,8647],{"className":8646},[722,723,724,725],[444,8648,3409],{"className":8649},[465,725]," when ",[444,8652,8654],{"className":8653},[447],[444,8655,8657,8677],{"className":8656,"ariaHidden":452},[451],[444,8658,8660,8664,8667,8670,8674],{"className":8659},[456],[444,8661],{"className":8662,"style":8663},[460],"height:0.7224em;vertical-align:-0.0391em;",[444,8665,4497],{"className":8666,"style":4496},[465,466],[444,8668],{"className":8669,"style":1150},[519],[444,8671,8673],{"className":8672},[1154],"≪",[444,8675],{"className":8676,"style":1150},[519],[444,8678,8680,8683],{"className":8679},[456],[444,8681],{"className":8682,"style":3396},[460],[444,8684,8686,8689],{"className":8685},[465],[444,8687,658],{"className":8688,"style":657},[465,466],[444,8690,8692],{"className":8691},[696],[444,8693,8695],{"className":8694},[700],[444,8696,8698],{"className":8697},[705],[444,8699,8701],{"className":8700,"style":3396},[709],[444,8702,8703,8706],{"style":3399},[444,8704],{"className":8705,"style":718},[717],[444,8707,8709],{"className":8708},[722,723,724,725],[444,8710,1794],{"className":8711},[465,725],[429,8713,8714,8717,8718,8721,8722,8725,8726,8741,8742,1511],{},[389,8715,8716],{},"Bellman–Ford",": single-source with ",[389,8719,8720],{},"negative edges",", negative-cycle\ndetection, or an ",[389,8723,8724],{},"edge-count cap"," (",[444,8727,8729],{"className":8728},[447],[444,8730,8732],{"className":8731,"ariaHidden":452},[451],[444,8733,8735,8738],{"className":8734},[456],[444,8736],{"className":8737,"style":461},[460],[444,8739,468],{"className":8740,"style":467},[465,466],"-stops); ",[444,8743,8745],{"className":8744},[447],[444,8746,8748],{"className":8747,"ariaHidden":452},[451],[444,8749,8751,8754,8757,8760,8763,8766],{"className":8750},[456],[444,8752],{"className":8753,"style":501},[460],[444,8755,4878],{"className":8756,"style":3885},[465,466],[444,8758,506],{"className":8759},[505],[444,8761,658],{"className":8762,"style":657},[465,466],[444,8764,4497],{"className":8765,"style":4496},[465,466],[444,8767,530],{"className":8768},[529],[429,8770,8771,8774,8775,8817],{},[389,8772,8773],{},"DAG-DP",": acyclic graphs; ",[444,8776,8778],{"className":8777},[447],[444,8779,8781,8805],{"className":8780,"ariaHidden":452},[451],[444,8782,8784,8787,8790,8793,8796,8799,8802],{"className":8783},[456],[444,8785],{"className":8786,"style":501},[460],[444,8788,4878],{"className":8789,"style":3885},[465,466],[444,8791,506],{"className":8792},[505],[444,8794,658],{"className":8795,"style":657},[465,466],[444,8797],{"className":8798,"style":657},[519],[444,8800,1185],{"className":8801},[1345],[444,8803],{"className":8804,"style":657},[519],[444,8806,8808,8811,8814],{"className":8807},[456],[444,8809],{"className":8810,"style":501},[460],[444,8812,4497],{"className":8813,"style":4496},[465,466],[444,8815,530],{"className":8816},[529],", handles negative weights and even\nlongest paths, because topological order removes the need to iterate to\nconvergence.",[611,8819,8821],{"id":8820},"takeaways","Takeaways",[426,8823,8824,8837,9332,9528,9587,9617],{},[429,8825,8826,8829,8830,8833,8834,1511],{},[389,8827,8828],{},"Many graph algorithms are dynamic programs."," The subproblem is the ",[397,8831,8832],{},"best\nvalue under a restricted resource"," (intermediate vertices, edges, a\ntopological prefix, or a visited subset), and ",[389,8835,8836],{},"edge relaxation is the DP\ntransition",[429,8838,8839,8841,8842,9161,9162,9177,9178,9228,9229,9279,9280,9331],{},[389,8840,8406],{}," is the archetype: ",[444,8843,8845],{"className":8844},[447],[444,8846,8848,8921,9088],{"className":8847,"ariaHidden":452},[451],[444,8849,8851,8854,8894,8897,8900,8903,8906,8909,8912,8915,8918],{"className":8850},[456],[444,8852],{"className":8853,"style":501},[460],[444,8855,8857,8860],{"className":8856},[465],[444,8858,692],{"className":8859},[465,466],[444,8861,8863],{"className":8862},[696],[444,8864,8866,8886],{"className":8865},[700,701],[444,8867,8869,8883],{"className":8868},[705],[444,8870,8872],{"className":8871,"style":710},[709],[444,8873,8874,8877],{"style":713},[444,8875],{"className":8876,"style":718},[717],[444,8878,8880],{"className":8879},[722,723,724,725],[444,8881,730],{"className":8882,"style":729},[465,466,725],[444,8884,735],{"className":8885},[734],[444,8887,8889],{"className":8888},[705],[444,8890,8892],{"className":8891,"style":742},[709],[444,8893],{},[444,8895,748],{"className":8896},[505],[444,8898,752],{"className":8899},[465,466],[444,8901,756],{"className":8902},[529],[444,8904,748],{"className":8905},[505],[444,8907,764],{"className":8908,"style":763},[465,466],[444,8910,756],{"className":8911},[529],[444,8913],{"className":8914,"style":1150},[519],[444,8916,1155],{"className":8917},[1154],[444,8919],{"className":8920,"style":1150},[519],[444,8922,8924,8927,8933,8936,8985,8988,8991,8994,8997,9000,9003,9006,9009,9012,9061,9064,9067,9070,9073,9076,9079,9082,9085],{"className":8923},[456],[444,8925],{"className":8926,"style":501},[460],[444,8928,8930],{"className":8929},[581],[444,8931,586],{"className":8932},[465,585],[444,8934,506],{"className":8935},[505],[444,8937,8939,8942],{"className":8938},[465],[444,8940,692],{"className":8941},[465,466],[444,8943,8945],{"className":8944},[696],[444,8946,8948,8977],{"className":8947},[700,701],[444,8949,8951,8974],{"className":8950},[705],[444,8952,8954],{"className":8953,"style":710},[709],[444,8955,8956,8959],{"style":713},[444,8957],{"className":8958,"style":718},[717],[444,8960,8962],{"className":8961},[722,723,724,725],[444,8963,8965,8968,8971],{"className":8964},[465,725],[444,8966,730],{"className":8967,"style":729},[465,466,725],[444,8969,1346],{"className":8970},[1345,725],[444,8972,609],{"className":8973},[465,725],[444,8975,735],{"className":8976},[734],[444,8978,8980],{"className":8979},[705],[444,8981,8983],{"className":8982,"style":2357},[709],[444,8984],{},[444,8986,748],{"className":8987},[505],[444,8989,752],{"className":8990},[465,466],[444,8992,756],{"className":8993},[529],[444,8995,748],{"className":8996},[505],[444,8998,764],{"className":8999,"style":763},[465,466],[444,9001,756],{"className":9002},[529],[444,9004,515],{"className":9005},[514],[444,9007],{"className":9008,"style":520},[519],[444,9010],{"className":9011,"style":520},[519],[444,9013,9015,9018],{"className":9014},[465],[444,9016,692],{"className":9017},[465,466],[444,9019,9021],{"className":9020},[696],[444,9022,9024,9053],{"className":9023},[700,701],[444,9025,9027,9050],{"className":9026},[705],[444,9028,9030],{"className":9029,"style":710},[709],[444,9031,9032,9035],{"style":713},[444,9033],{"className":9034,"style":718},[717],[444,9036,9038],{"className":9037},[722,723,724,725],[444,9039,9041,9044,9047],{"className":9040},[465,725],[444,9042,730],{"className":9043,"style":729},[465,466,725],[444,9045,1346],{"className":9046},[1345,725],[444,9048,609],{"className":9049},[465,725],[444,9051,735],{"className":9052},[734],[444,9054,9056],{"className":9055},[705],[444,9057,9059],{"className":9058,"style":2357},[709],[444,9060],{},[444,9062,748],{"className":9063},[505],[444,9065,752],{"className":9066},[465,466],[444,9068,756],{"className":9069},[529],[444,9071,748],{"className":9072},[505],[444,9074,730],{"className":9075,"style":729},[465,466],[444,9077,756],{"className":9078},[529],[444,9080],{"className":9081,"style":657},[519],[444,9083,1185],{"className":9084},[1345],[444,9086],{"className":9087,"style":657},[519],[444,9089,9091,9094,9143,9146,9149,9152,9155,9158],{"className":9090},[456],[444,9092],{"className":9093,"style":501},[460],[444,9095,9097,9100],{"className":9096},[465],[444,9098,692],{"className":9099},[465,466],[444,9101,9103],{"className":9102},[696],[444,9104,9106,9135],{"className":9105},[700,701],[444,9107,9109,9132],{"className":9108},[705],[444,9110,9112],{"className":9111,"style":710},[709],[444,9113,9114,9117],{"style":713},[444,9115],{"className":9116,"style":718},[717],[444,9118,9120],{"className":9119},[722,723,724,725],[444,9121,9123,9126,9129],{"className":9122},[465,725],[444,9124,730],{"className":9125,"style":729},[465,466,725],[444,9127,1346],{"className":9128},[1345,725],[444,9130,609],{"className":9131},[465,725],[444,9133,735],{"className":9134},[734],[444,9136,9138],{"className":9137},[705],[444,9139,9141],{"className":9140,"style":2357},[709],[444,9142],{},[444,9144,748],{"className":9145},[505],[444,9147,730],{"className":9148,"style":729},[465,466],[444,9150,756],{"className":9151},[529],[444,9153,748],{"className":9154},[505],[444,9156,764],{"className":9157,"style":763},[465,466],[444,9159,6856],{"className":9160},[529],", route through ",[444,9163,9165],{"className":9164},[447],[444,9166,9168],{"className":9167,"ariaHidden":452},[451],[444,9169,9171,9174],{"className":9170},[456],[444,9172],{"className":9173,"style":1295},[460],[444,9175,730],{"className":9176,"style":729},[465,466]," or don't, collapsing in\nplace to ",[444,9179,9181],{"className":9180},[447],[444,9182,9184],{"className":9183,"ariaHidden":452},[451],[444,9185,9187,9190,9193,9196,9225],{"className":9186},[456],[444,9188],{"className":9189,"style":3370},[460],[444,9191,4878],{"className":9192,"style":3885},[465,466],[444,9194,506],{"className":9195},[505],[444,9197,9199,9202],{"className":9198},[465],[444,9200,658],{"className":9201,"style":657},[465,466],[444,9203,9205],{"className":9204},[696],[444,9206,9208],{"className":9207},[700],[444,9209,9211],{"className":9210},[705],[444,9212,9214],{"className":9213,"style":3396},[709],[444,9215,9216,9219],{"style":3399},[444,9217],{"className":9218,"style":718},[717],[444,9220,9222],{"className":9221},[722,723,724,725],[444,9223,3409],{"className":9224},[465,725],[444,9226,530],{"className":9227},[529]," time, ",[444,9230,9232],{"className":9231},[447],[444,9233,9235],{"className":9234,"ariaHidden":452},[451],[444,9236,9238,9241,9244,9247,9276],{"className":9237},[456],[444,9239],{"className":9240,"style":3370},[460],[444,9242,4878],{"className":9243,"style":3885},[465,466],[444,9245,506],{"className":9246},[505],[444,9248,9250,9253],{"className":9249},[465],[444,9251,658],{"className":9252,"style":657},[465,466],[444,9254,9256],{"className":9255},[696],[444,9257,9259],{"className":9258},[700],[444,9260,9262],{"className":9261},[705],[444,9263,9265],{"className":9264,"style":3396},[709],[444,9266,9267,9270],{"style":3399},[444,9268],{"className":9269,"style":718},[717],[444,9271,9273],{"className":9272},[722,723,724,725],[444,9274,1794],{"className":9275},[465,725],[444,9277,530],{"className":9278},[529]," space; negative edges OK, and ",[444,9281,9283],{"className":9282},[447],[444,9284,9286,9322],{"className":9285,"ariaHidden":452},[451],[444,9287,9289,9292,9295,9298,9301,9304,9307,9310,9313,9316,9319],{"className":9288},[456],[444,9290],{"className":9291,"style":501},[460],[444,9293,692],{"className":9294},[465,466],[444,9296,748],{"className":9297},[505],[444,9299,752],{"className":9300},[465,466],[444,9302,756],{"className":9303},[529],[444,9305,748],{"className":9306},[505],[444,9308,752],{"className":9309},[465,466],[444,9311,756],{"className":9312},[529],[444,9314],{"className":9315,"style":1150},[519],[444,9317,3536],{"className":9318},[1154],[444,9320],{"className":9321,"style":1150},[519],[444,9323,9325,9328],{"className":9324},[456],[444,9326],{"className":9327,"style":1127},[460],[444,9329,992],{"className":9330},[465],"\nflags a negative cycle.",[429,9333,9334,9336,9337,9398,9399,9414,9415,9448,9449,1646,9464,9497,9498,8725,9500,9527],{},[389,9335,8716],{}," is a DP over path length, ",[444,9338,9340],{"className":9339},[447],[444,9341,9343],{"className":9342,"ariaHidden":452},[451],[444,9344,9346,9349,9389,9392,9395],{"className":9345},[456],[444,9347],{"className":9348,"style":501},[460],[444,9350,9352,9355],{"className":9351},[465],[444,9353,3886],{"className":9354,"style":3885},[465,466],[444,9356,9358],{"className":9357},[696],[444,9359,9361,9381],{"className":9360},[700,701],[444,9362,9364,9378],{"className":9363},[705],[444,9365,9367],{"className":9366,"style":3899},[709],[444,9368,9369,9372],{"style":3902},[444,9370],{"className":9371,"style":718},[717],[444,9373,9375],{"className":9374},[722,723,724,725],[444,9376,3912],{"className":9377},[465,466,725],[444,9379,735],{"className":9380},[734],[444,9382,9384],{"className":9383},[705],[444,9385,9387],{"className":9386,"style":742},[709],[444,9388],{},[444,9390,748],{"className":9391},[505],[444,9393,525],{"className":9394,"style":524},[465,466],[444,9396,756],{"className":9397},[529]," for at-most-",[444,9400,9402],{"className":9401},[447],[444,9403,9405],{"className":9404,"ariaHidden":452},[451],[444,9406,9408,9411],{"className":9407},[456],[444,9409],{"className":9410,"style":3584},[460],[444,9412,3912],{"className":9413},[465,466]," edges;\n",[444,9416,9418],{"className":9417},[447],[444,9419,9421,9439],{"className":9420,"ariaHidden":452},[451],[444,9422,9424,9427,9430,9433,9436],{"className":9423},[456],[444,9425],{"className":9426,"style":4651},[460],[444,9428,658],{"className":9429,"style":657},[465,466],[444,9431],{"className":9432,"style":657},[519],[444,9434,1346],{"className":9435},[1345],[444,9437],{"className":9438,"style":657},[519],[444,9440,9442,9445],{"className":9441},[456],[444,9443],{"className":9444,"style":1127},[460],[444,9446,609],{"className":9447},[465]," rounds converge, an extra relaxation detects a negative cycle, and\ncapping ",[444,9450,9452],{"className":9451},[447],[444,9453,9455],{"className":9454,"ariaHidden":452},[451],[444,9456,9458,9461],{"className":9457},[456],[444,9459],{"className":9460,"style":3584},[460],[444,9462,3912],{"className":9463},[465,466],[444,9465,9467],{"className":9466},[447],[444,9468,9470,9488],{"className":9469,"ariaHidden":452},[451],[444,9471,9473,9476,9479,9482,9485],{"className":9472},[456],[444,9474],{"className":9475,"style":4651},[460],[444,9477,468],{"className":9478,"style":467},[465,466],[444,9480],{"className":9481,"style":657},[519],[444,9483,1185],{"className":9484},[1345],[444,9486],{"className":9487,"style":657},[519],[444,9489,9491,9494],{"className":9490},[456],[444,9492],{"className":9493,"style":1127},[460],[444,9495,609],{"className":9496},[465]," solves ",[389,9499,4900],{},[444,9501,9503],{"className":9502},[447],[444,9504,9506],{"className":9505,"ariaHidden":452},[451],[444,9507,9509,9512,9515,9518,9521,9524],{"className":9508},[456],[444,9510],{"className":9511,"style":501},[460],[444,9513,4878],{"className":9514,"style":3885},[465,466],[444,9516,506],{"className":9517},[505],[444,9519,658],{"className":9520,"style":657},[465,466],[444,9522,4497],{"className":9523,"style":4496},[465,466],[444,9525,530],{"className":9526},[529],").",[429,9529,9530,9532,9533,9535,9536,9578,9579,9582,9583,9586],{},[389,9531,8773],{}," processes vertices in ",[389,9534,5780],{}," for an ",[444,9537,9539],{"className":9538},[447],[444,9540,9542,9566],{"className":9541,"ariaHidden":452},[451],[444,9543,9545,9548,9551,9554,9557,9560,9563],{"className":9544},[456],[444,9546],{"className":9547,"style":501},[460],[444,9549,4878],{"className":9550,"style":3885},[465,466],[444,9552,506],{"className":9553},[505],[444,9555,658],{"className":9556,"style":657},[465,466],[444,9558],{"className":9559,"style":657},[519],[444,9561,1185],{"className":9562},[1345],[444,9564],{"className":9565,"style":657},[519],[444,9567,9569,9572,9575],{"className":9568},[456],[444,9570],{"className":9571,"style":501},[460],[444,9573,4497],{"className":9574,"style":4496},[465,466],[444,9576,530],{"className":9577},[529]," single\npass, shortest ",[397,9580,9581],{},"or"," longest path, and ",[389,9584,9585],{},"counting (shortest) paths"," by\ncarrying a count alongside the distance.",[429,9588,9589,9592,9593,9614,9615,1511],{},[389,9590,9591],{},"Warshall's transitive closure"," is the boolean Floyd–Warshall\n(",[444,9594,9596],{"className":9595},[447],[444,9597,9599],{"className":9598,"ariaHidden":452},[451],[444,9600,9602,9605,9608,9611],{"className":9601},[456],[444,9603],{"className":9604,"style":501},[460],[444,9606,7344],{"className":9607},[465],[444,9609,7324],{"className":9610},[465],[444,9612,7351],{"className":9613},[465],"), giving reachability, exactly ",[389,9616,7922],{},[429,9618,9619,9620,9622],{},"The resource can be a ",[389,9621,481],{}," (Held–Karp \u002F bitmask TSP), unifying scalar\nshortest paths with exponential-state DP under one frame.",[9624,9625,9628,9633],"section",{"className":9626,"dataFootnotes":376},[9627],"footnotes",[611,9629,9632],{"className":9630,"id":607},[9631],"sr-only","Footnotes",[9634,9635,9636,9650,9764,9809],"ol",{},[429,9637,9639,9642,9643],{"id":9638},"user-content-fn-erickson-dp",[389,9640,9641],{},"Erickson",", Ch. — Dynamic Programming: the DP recipe is to define the subproblem, write the recurrence, and evaluate in an order respecting the dependency DAG. ",[385,9644,9649],{"href":9645,"ariaLabel":9646,"className":9647,"dataFootnoteBackref":376},"#user-content-fnref-erickson-dp","Back to reference 1",[9648],"data-footnote-backref","↩",[429,9651,9653,9656,9657,9707,9708,4897,9759],{"id":9652},"user-content-fn-clrs-fw",[389,9654,9655],{},"CLRS",", Ch. 23 — All-Pairs Shortest Paths (§23.2): Floyd–Warshall's intermediate-vertex recurrence, ",[444,9658,9660],{"className":9659},[447],[444,9661,9663],{"className":9662,"ariaHidden":452},[451],[444,9664,9666,9669,9672,9675,9704],{"className":9665},[456],[444,9667],{"className":9668,"style":3370},[460],[444,9670,3374],{"className":9671},[465],[444,9673,506],{"className":9674},[505],[444,9676,9678,9681],{"className":9677},[465],[444,9679,658],{"className":9680,"style":657},[465,466],[444,9682,9684],{"className":9683},[696],[444,9685,9687],{"className":9686},[700],[444,9688,9690],{"className":9689},[705],[444,9691,9693],{"className":9692,"style":3396},[709],[444,9694,9695,9698],{"style":3399},[444,9696],{"className":9697,"style":718},[717],[444,9699,9701],{"className":9700},[722,723,724,725],[444,9702,3409],{"className":9703},[465,725],[444,9705,530],{"className":9706},[529]," in-place evaluation, and negative-cycle detection via ",[444,9709,9711],{"className":9710},[447],[444,9712,9714,9750],{"className":9713,"ariaHidden":452},[451],[444,9715,9717,9720,9723,9726,9729,9732,9735,9738,9741,9744,9747],{"className":9716},[456],[444,9718],{"className":9719,"style":501},[460],[444,9721,692],{"className":9722},[465,466],[444,9724,748],{"className":9725},[505],[444,9727,752],{"className":9728},[465,466],[444,9730,756],{"className":9731},[529],[444,9733,748],{"className":9734},[505],[444,9736,752],{"className":9737},[465,466],[444,9739,756],{"className":9740},[529],[444,9742],{"className":9743,"style":1150},[519],[444,9745,3536],{"className":9746},[1154],[444,9748],{"className":9749,"style":1150},[519],[444,9751,9753,9756],{"className":9752},[456],[444,9754],{"className":9755,"style":1127},[460],[444,9757,992],{"className":9758},[465],[385,9760,9649],{"href":9761,"ariaLabel":9762,"className":9763,"dataFootnoteBackref":376},"#user-content-fnref-clrs-fw","Back to reference 2",[9648],[429,9765,9767,9769,9770,9803,9804],{"id":9766},"user-content-fn-clrs-bf",[389,9768,9655],{},", Ch. 22 — Single-Source Shortest Paths: Bellman–Ford relaxes all edges ",[444,9771,9773],{"className":9772},[447],[444,9774,9776,9794],{"className":9775,"ariaHidden":452},[451],[444,9777,9779,9782,9785,9788,9791],{"className":9778},[456],[444,9780],{"className":9781,"style":4651},[460],[444,9783,658],{"className":9784,"style":657},[465,466],[444,9786],{"className":9787,"style":657},[519],[444,9789,1346],{"className":9790},[1345],[444,9792],{"className":9793,"style":657},[519],[444,9795,9797,9800],{"className":9796},[456],[444,9798],{"className":9799,"style":1127},[460],[444,9801,609],{"className":9802},[465]," times; a further relaxation reveals a negative cycle. ",[385,9805,9649],{"href":9806,"ariaLabel":9807,"className":9808,"dataFootnoteBackref":376},"#user-content-fnref-clrs-bf","Back to reference 3",[9648],[429,9810,9812,9815,9816,9858,9859],{"id":9811},"user-content-fn-skiena-dag",[389,9813,9814],{},"Skiena",", § — Shortest Paths \u002F DP: shortest and longest paths on a DAG in ",[444,9817,9819],{"className":9818},[447],[444,9820,9822,9846],{"className":9821,"ariaHidden":452},[451],[444,9823,9825,9828,9831,9834,9837,9840,9843],{"className":9824},[456],[444,9826],{"className":9827,"style":501},[460],[444,9829,4878],{"className":9830,"style":3885},[465,466],[444,9832,506],{"className":9833},[505],[444,9835,658],{"className":9836,"style":657},[465,466],[444,9838],{"className":9839,"style":657},[519],[444,9841,1185],{"className":9842},[1345],[444,9844],{"className":9845,"style":657},[519],[444,9847,9849,9852,9855],{"className":9848},[456],[444,9850],{"className":9851,"style":501},[460],[444,9853,4497],{"className":9854,"style":4496},[465,466],[444,9856,530],{"className":9857},[529]," by relaxing edges in topological order; longest path is NP-hard only in general graphs. ",[385,9860,9649],{"href":9861,"ariaLabel":9862,"className":9863,"dataFootnoteBackref":376},"#user-content-fnref-skiena-dag","Back to reference 4",[9648],[9865,9866,9867],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark-mode .shiki span {color: var(--shiki-dark-mode);background: var(--shiki-dark-mode-bg);font-style: var(--shiki-dark-mode-font-style);font-weight: var(--shiki-dark-mode-font-weight);text-decoration: var(--shiki-dark-mode-text-decoration);}html.dark-mode .shiki span {color: var(--shiki-dark-mode);background: var(--shiki-dark-mode-bg);font-style: var(--shiki-dark-mode-font-style);font-weight: var(--shiki-dark-mode-font-weight);text-decoration: var(--shiki-dark-mode-text-decoration);}",{"title":376,"searchDepth":18,"depth":18,"links":9869},[9870,9871,9872,9873,9874,9875,9876,9877],{"id":613,"depth":18,"text":614},{"id":3853,"depth":18,"text":3854},{"id":5769,"depth":18,"text":5770},{"id":7284,"depth":18,"text":7285},{"id":8015,"depth":18,"text":8016},{"id":8395,"depth":18,"text":8396},{"id":8820,"depth":18,"text":8821},{"id":607,"depth":18,"text":9632},"The Graphs module's Shortest Paths lesson\nintroduced three algorithms (Dijkstra, Bellman–Ford, Floyd–Warshall) and\nremarked that one operation, relaxation, underlies them all. The\nPrinciples of Dynamic Programming\nlesson then distilled DP into optimal substructure plus overlapping\nsubproblems. This lesson connects the two ideas with a single thesis: many\ngraph algorithms are dynamic programs, and relaxation is the DP\ntransition.","md",{"moduleNumber":196,"lessonNumber":283,"order":9881},810,true,[9884,9887,9889,9892,9894],{"title":3849,"slug":9885,"difficulty":9886},"find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance","Medium",{"title":7922,"slug":9888,"difficulty":9886},"course-schedule-iv",{"title":9890,"slug":9891,"difficulty":9886},"Number of Ways to Arrive at Destination","number-of-ways-to-arrive-at-destination",{"title":4900,"slug":9893,"difficulty":9886},"cheapest-flights-within-k-stops",{"title":8356,"slug":9895,"difficulty":9896},"shortest-path-visiting-all-nodes","Hard","---\ntitle: Dynamic Programming on Graphs\nmodule: Dynamic Programming\nmoduleNumber: 8\nlessonNumber: 10\norder: 810\nsummary: >-\n  Many graph algorithms are dynamic programs in disguise: the subproblem is the\n  _best value reachable under a restricted resource_ — intermediate vertices\n  allowed, edges allowed, or a topological prefix — and edge _relaxation_ is the\n  DP transition. We frame Floyd–Warshall as the archetype ($O(V^3)$ all-pairs\n  shortest paths), Bellman–Ford as a DP over path length (the at-most-$K$-stops\n  variant), DAG-DP in topological order ($O(V+E)$), and Warshall's transitive\n  closure as the boolean analog.\ntopics: [Dynamic Programming]\nsources:\n  - book: CLRS\n    ref: \"Ch. 23 — All-Pairs Shortest Paths (§23.2 Floyd–Warshall)\"\n  - book: Skiena\n    ref: \"§ — Shortest Paths \u002F DP\"\n  - book: Erickson\n    ref: \"Ch. — Dynamic Programming\"\npractice:\n  - title: 'Find the City With the Smallest Number of Neighbors at a Threshold Distance'\n    slug: find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance\n    difficulty: Medium\n  - title: 'Course Schedule IV'\n    slug: course-schedule-iv\n    difficulty: Medium\n  - title: 'Number of Ways to Arrive at Destination'\n    slug: number-of-ways-to-arrive-at-destination\n    difficulty: Medium\n  - title: 'Cheapest Flights Within K Stops'\n    slug: cheapest-flights-within-k-stops\n    difficulty: Medium\n  - title: 'Shortest Path Visiting All Nodes'\n    slug: shortest-path-visiting-all-nodes\n    difficulty: Hard\n---\n\nThe Graphs module's [Shortest Paths](\u002Falgorithms\u002Fgraphs\u002Fshortest-paths) lesson\nintroduced three algorithms (Dijkstra, Bellman–Ford, Floyd–Warshall) and\nremarked that one operation, **relaxation**, underlies them all. The\n[Principles of Dynamic Programming](\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples)\nlesson then distilled DP into _optimal substructure plus overlapping\nsubproblems_. This lesson connects the two ideas with a single thesis: **many\ngraph algorithms _are_ dynamic programs**, and relaxation _is_ the DP\ntransition.\n\nThe pattern is always the same. We define a subproblem as the **best value\nobtainable using a restricted resource**, and we grow the resource one unit at a\ntime. The \"resource\" is whatever we ration:\n\n- the set of **intermediate vertices** a path may pass through (Floyd–Warshall);\n- the number of **edges** a path may use (Bellman–Ford, $K$-stops);\n- a **topological prefix** of an acyclic graph (DAG-DP);\n- a **subset** of vertices already visited (Held–Karp, the\n  [Bitmask DP](\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp) lesson).\n\nRelaxing an edge $(u,v)$, testing whether routing through $u$ improves the\ncurrent estimate for $v$, is exactly the $\\min$ over choices in a DP recurrence.\nOnce you see this, \"is there a path?\", \"what is the cheapest path?\", and \"how\nmany shortest paths are there?\" all become the same exercise: pick the resource,\nwrite the recurrence, choose an evaluation order that respects the\ndependencies.[^erickson-dp]\n\n## Floyd–Warshall: intermediate vertices as the resource\n\nNumber the vertices $1,\\dots,V$. Restrict _which vertices a\npath is allowed to pass through internally_, and relax that restriction one\nvertex at a time.\n\n> **Definition.** Let $d_k[i][j]$ be the weight of a shortest path from $i$ to\n> $j$ all of whose **intermediate** vertices lie in $\\{1,\\dots,k\\}$ (the\n> endpoints $i,j$ are unrestricted). Then $d_V[i][j]$ is the true all-pairs\n> shortest distance, and $d_0$ is just the weight matrix.\n\nThe base case $d_0[i][j]$ is $w(i,j)$ if the edge exists, $0$ if $i=j$, and\n$+\\infty$ otherwise, since no intermediate vertices are allowed, so only direct\nedges count. The induction is the core of the method.\n\n> **Lemma (optimal substructure).** A shortest $i\\rightsquigarrow j$ path with\n> intermediate vertices drawn from $\\{1,\\dots,k\\}$ either **does not use** $k$,\n> in which case it is a shortest path through $\\{1,\\dots,k-1\\}$, or it **uses\n> $k$ exactly once**, splitting into a shortest $i\\rightsquigarrow k$ path and a\n> shortest $k\\rightsquigarrow j$ path, each through $\\{1,\\dots,k-1\\}$.\n\n> **Proof.** Consider a shortest such path $p$. If $k$ is not an intermediate\n> vertex of $p$, all its intermediate vertices already lie in $\\{1,\\dots,k-1\\}$.\n> Otherwise decompose $p$ at $k$ into $p_1 : i\\rightsquigarrow k$ and\n> $p_2 : k\\rightsquigarrow j$. Since the graph has no negative cycle, no\n> shortest path repeats a vertex, so $k$ appears only at the split and the\n> intermediate vertices of $p_1$ and $p_2$ lie in $\\{1,\\dots,k-1\\}$. Each leg\n> must itself be shortest (a cheaper leg would cheapen $p$), giving the\n> two-term option. $\\qed$\n\nThe lemma is a verbatim DP transition, route through $k$ or don't:\n\n$$\nd_k[i][j] = \\min\\big(\\,\\underbrace{d_{k-1}[i][j]}_{\\text{avoid }k},\\ \\underbrace{d_{k-1}[i][k] + d_{k-1}[k][j]}_{\\text{through }k}\\,\\big).\n$$\n\n$$\n% caption: route through $k$, or don't — the Floyd–Warshall $\\min$\n\\begin{tikzpicture}[\n  every node\u002F.style={circle, draw, minimum size=8mm, inner sep=0},\n  >=stealth]\n  \\definecolor{acc}{HTML}{2348F2}\n  \\node (i) at (0,0) {$i$};\n  \\node (j) at (5,0) {$j$};\n  \\node (k) at (2.5,1.8) {$k$};\n  % direct option (curved below, plain)\n  \\draw[->, bend right=22] (i) to node[draw=none, below, font=\\footnotesize] {$d_{k-1}[i][j]$} (j);\n  % through-k option, highlighted\n  \\draw[->, thick, acc] (i) -- node[draw=none, above left=-1mm, font=\\footnotesize] {$d_{k-1}[i][k]$} (k);\n  \\draw[->, thick, acc] (k) -- node[draw=none, above right=-1mm, font=\\footnotesize] {$d_{k-1}[k][j]$} (j);\n  \\node[draw=none, font=\\footnotesize] at (2.5,-1.55) {$d_k[i][j]=\\min(\\text{below},\\ \\text{through }k)$};\n\\end{tikzpicture}\n$$\n\nBecause $d_k$ depends only on $d_{k-1}$, and the two cells it reads in row\u002Fcolumn\n$k$ are unchanged when $i=k$ or $j=k$, we can **drop the $k$ index and update the\nmatrix in place**. This yields the entire algorithm in three nested loops with\n$k$ outermost:\n\n```algorithm\ncaption: $\\textsc{Floyd-Warshall}(W)$ — all-pairs shortest paths in $O(V^3)$\n$d \\gets W$ \u002F\u002F $w(i,j)$; $0$ on diagonal, else $\\infty$\nfor $k \\gets 1$ to $V$ do\n  for $i \\gets 1$ to $V$ do\n    for $j \\gets 1$ to $V$ do\n      if $d[i][k] + d[k][j] \u003C d[i][j]$ then\n        $d[i][j] \\gets d[i][k] + d[k][j]$\n        $\\text{next}[i][j] \\gets \\text{next}[i][k]$ \u002F\u002F for reconstruction\nreturn $d$\n```\n\nThe triple loop is $\\Theta(V^3)$ time and $\\Theta(V^2)$ space, independent of the\nedge count, which is what makes Floyd–Warshall the method of choice for **dense**\ngraphs where we want _every_ pair at once.[^clrs-fw]\n\n> **Remark (negative edges).** The derivation never assumed non-negative weights,\n> only the _absence of negative cycles_ (used to argue shortest paths are\n> simple). So Floyd–Warshall handles negative edges directly, unlike Dijkstra.\n> And it **detects** a negative cycle for free: after the algorithm, a negative\n> cycle exists iff $d[i][i] \u003C 0$ for some $i$, meaning some vertex can reach\n> itself at negative cost.\n\n**Path reconstruction** uses a $\\text{next}$ matrix (above) initialized to\n$\\text{next}[i][j]=j$ for each edge: whenever routing through $k$ wins, the first\nhop out of $i$ toward $j$ becomes the first hop toward $k$. To rebuild a path,\nfollow $i \\to \\text{next}[i][j] \\to \\cdots \\to j$. (A $\\text{pred}$ matrix storing\nthe _last_ vertex before $j$ is the symmetric alternative.) The practice problem\n_Find the City With the Smallest Number of Neighbors at a Threshold Distance_ is\nFloyd–Warshall verbatim: compute all-pairs distances, then count for each city\nhow many others lie within the threshold.\n\n## Bellman–Ford: edges as the resource\n\nFloyd–Warshall rations intermediate vertices. Bellman–Ford rations **edges**,\nwhich makes it a single-source DP over path length.\n\n> **Definition.** Let $D_t[v]$ be the shortest distance from the source $s$ to\n> $v$ using a path of **at most $t$ edges**. Then $D_0[s]=0$, $D_0[v]=\\infty$\n> otherwise.\n\nA walk of at most $t$ edges to $v$ is either a walk of at most $t-1$ edges to\n$v$, or such a walk to some predecessor $u$ followed by the edge $(u,v)$:\n\n$$\nD_t[v] = \\min\\Big(D_{t-1}[v],\\ \\min_{(u,v)\\in E} D_{t-1}[u] + w(u,v)\\Big).\n$$\n\nEach round is one full sweep of edge relaxations, exactly the relaxation\nprimitive from the Shortest Paths lesson, now indexed by a layer $t$. Because a\nshortest path in a graph with no negative cycle is **simple**, it uses at most\n$V-1$ edges, so $D_{V-1}$ is the answer: after $V-1$ rounds the table converges.\nIf one more round still relaxes some edge, a path of $\\ge V$ edges beats every\nshorter one, which can only happen along a **negative cycle**, so that extra\nrelaxation is the standard negative-cycle test.[^clrs-bf] The cost is $V-1$\nsweeps of $E$ edges, $O(VE)$.\n\nThe layered view pays off directly when the problem **caps the number of\nedges**. _Cheapest Flights Within K Stops_ asks for the cheapest $s\\to t$ route\nusing at most $K$ stops, i.e. at most $K+1$ edges. That is precisely $D_{K+1}[t]$:\nrun exactly $K+1$ Bellman–Ford rounds, no more.\n\n$$\n% caption: Bellman–Ford as a DP over path length: $D_t[v]$ = cheapest $s\\to v$ using\n%          $\\le t$ edges; each round relaxes against the previous layer, so capping $t$\n%          solves the $K$-stops variant\n\\begin{tikzpicture}[\n  cell\u002F.style={draw, minimum width=9mm, minimum height=7mm, inner sep=1pt, font=\\footnotesize},\n  >=stealth]\n  \\definecolor{acc}{HTML}{2348F2}\n  \\foreach \\c\u002F\\lab in {1\u002Fs,2\u002Fa,3\u002Fb,4\u002Ft} {\n    \\node[font=\\footnotesize] at (\\c*1.0+0.4,0.7) {$\\lab$};\n  }\n  \\foreach \\r\u002F\\lab in {0\u002F{t{=}0},1\u002F{t{=}1},2\u002F{t{=}2},3\u002F{t{=}3}} {\n    \\node[font=\\footnotesize] at (0.4,-\\r*0.75) {$\\lab$};\n  }\n  \\foreach \\c\u002F\\v in {1\u002F$0$,2\u002F$\\infty$,3\u002F$\\infty$,4\u002F$\\infty$} \\node[cell] at (\\c*1.0+0.4,0) {\\v};\n  \\foreach \\c\u002F\\v in {1\u002F$0$,2\u002F$4$,3\u002F$5$,4\u002F$\\infty$} \\node[cell] at (\\c*1.0+0.4,-0.75) {\\v};\n  \\node[cell] at (1.4,-1.5) {$0$};\n  \\node[cell] at (2.4,-1.5) {$4$};\n  \\node[cell, fill=acc!15] at (3.4,-1.5) {$2$};\n  \\node[cell] at (4.4,-1.5) {$8$};\n  \\node[cell] at (1.4,-2.25) {$0$};\n  \\node[cell] at (2.4,-2.25) {$4$};\n  \\node[cell] at (3.4,-2.25) {$2$};\n  \\node[cell, fill=acc!15] at (4.4,-2.25) {$5$};\n  \\node[font=\\footnotesize, acc] at (7.0,-1.5) {$b$: $4{-}2{=}2$};\n  \\node[font=\\footnotesize, acc] at (7.0,-2.25) {$t$: $2{+}3{=}5$};\n\\end{tikzpicture}\n$$\n\n> **Remark (snapshot the layer).** With the $K$-stops cap you must relax against\n> the _previous_ layer $D_{t-1}$, not the layer being filled, since otherwise a path\n> updated earlier in the same sweep could be reused, smuggling in an extra edge.\n> Copy $D_{t-1}$ before each round (or relax the original edge list into a fresh\n> array). The unbounded version may safely update in place, since extra\n> relaxations only help once the edge budget is irrelevant.\n\n## DAG-DP: a topological prefix as the resource\n\nWhen the graph is **acyclic**, the resource becomes trivial to ration: process\nvertices in\n[topological order](\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc). A topological\norder lists every vertex after\nall of its predecessors, so by the time we reach $v$, every $D[u]$ for an\nincoming edge $(u,v)$ is already final. The recurrence has no cycles, so a\n**single pass** suffices, with no convergence over $V-1$ rounds and no $\\min$\nover $k$ layers.\n\n```algorithm\ncaption: $\\textsc{DAG-Relax}(G, s)$ — shortest\u002Flongest paths on a DAG in $O(V+E)$\n$\\text{topologically sort } G$\n$D[v] \\gets \\infty$ for all $v$;  $D[s] \\gets 0$\nfor each $u$ in topological order do\n  for each edge $(u,v)$ do\n    if $D[u] + w(u,v) \u003C D[v]$ then  \u002F\u002F use $\\max$ for longest path\n      $D[v] \\gets D[u] + w(u,v)$\nreturn $D$\n```\n\nEach vertex and edge is touched once, so DAG-DP runs in $\\Theta(V+E)$, faster\nthan Dijkstra and immune to negative weights, because acyclicity replaces the\nnon-negativity that Dijkstra needs. The **longest path** problem,\nNP-hard in general graphs, is _just as easy_ on a DAG: swap $\\min$ for $\\max$.\nAcyclicity is what makes the difference.[^skiena-dag]\n\n$$\n% caption: one pass in topo order — longest-path values, chosen edge in $acc$\n\\begin{tikzpicture}[\n  every node\u002F.style={circle, draw, minimum size=9mm, inner sep=0, font=\\small},\n  >=stealth, node distance=14mm]\n  \\definecolor{acc}{HTML}{2348F2}\n  \\node (a) at (0,0) {$a$};\n  \\node (b) at (2.4,0.9) {$b$};\n  \\node (c) at (2.4,-0.9) {$c$};\n  \\node (d) at (4.8,0) {$d$};\n  % values above each node\n  \\node[draw=none, font=\\footnotesize] at (0,1.0) {$0$};\n  \\node[draw=none, font=\\footnotesize] at (2.4,1.9) {$3$};\n  \\node[draw=none, font=\\footnotesize] at (2.4,-1.9) {$2$};\n  \\node[draw=none, font=\\footnotesize] at (4.8,1.0) {$7$};\n  \\draw[->] (a) -- node[draw=none, above left=-1.5mm, font=\\footnotesize] {$3$} (b);\n  \\draw[->] (a) -- node[draw=none, below left=-1.5mm, font=\\footnotesize] {$2$} (c);\n  \\draw[->, thick, acc] (b) -- node[draw=none, above right=-1.5mm, font=\\footnotesize] {$4$} (d);\n  \\draw[->] (c) -- node[draw=none, below right=-1.5mm, font=\\footnotesize] {$1$} (d);\n\\end{tikzpicture}\n$$\n\nIn the figure, $d$ is reached by $3+4=7$ via $b$ versus $2+1=3$ via $c$; the\n$\\max$ keeps the through-$b$ edge (in `acc`), and because $b$ and $c$ were\nfinalized before $d$ in topological order, one forward sweep settles it.\n\n**Counting paths** rides on the same order. To count _all_ paths $s\\to t$ in a\nDAG, set $\\text{cnt}[s]=1$ and accumulate\n$\\text{cnt}[v] \\mathrel{+}= \\text{cnt}[u]$ over incoming edges in topo order. To\ncount **shortest** paths in a weighted graph that may have cycles (_Number of\nWays to Arrive at Destination_), process vertices in **non-decreasing distance\norder** (the order Dijkstra finalizes them, which is a topological order of the\nshortest-path DAG) and carry a parallel count:\n\n$$\n\\text{when } D[u] + w(u,v) = D[v]:\\ \\ \\text{cnt}[v] \\mathrel{+}= \\text{cnt}[u]\n\\quad(\\text{a strict improvement instead } \\textit{resets } \\text{cnt}[v]).\n$$\n\nThe distance DP finds the best value; the count DP, evaluated in the same order,\ntallies how many ways achieve it.\n\n$$\n% caption: Counting $s\\to t$ paths in topo order: $\\text{cnt}[s]=1$, then\n%          $\\text{cnt}[v]\\mathrel{+}=\\text{cnt}[u]$ over incoming edges — here\n%          $\\text{cnt}[t]=1+2=3$\n\\begin{tikzpicture}[\n  every node\u002F.style={circle, draw, minimum size=9mm, inner sep=0, font=\\small},\n  >=stealth]\n  \\definecolor{acc}{HTML}{2348F2}\n  \\node (s) at (0,0) {$s$};\n  \\node (a) at (2.2,1.1) {$a$};\n  \\node (b) at (2.2,-1.1) {$b$};\n  \\node[draw=acc, very thick, text=acc] (t) at (4.4,0) {$t$};\n  \\draw[->] (s) -- (a);\n  \\draw[->] (s) -- (b);\n  \\draw[->] (a) -- (b);\n  \\draw[->] (a) -- (t);\n  \\draw[->] (b) -- (t);\n  \\node[draw=none, font=\\footnotesize] at (0,0.85) {$\\text{cnt}{=}1$};\n  \\node[draw=none, font=\\footnotesize] at (2.2,1.95) {$\\text{cnt}{=}1$};\n  \\node[draw=none, font=\\footnotesize] at (2.2,-1.95) {$\\text{cnt}{=}2$};\n  \\node[draw=none, font=\\footnotesize, acc] at (4.4,0.95) {$\\text{cnt}{=}3$};\n\\end{tikzpicture}\n$$\n\n## Warshall's transitive closure: the boolean analog\n\nReplace \"shortest distance\" with \"is there _any_ path\", and $\\min\u002F+$ with\n$\\lor\u002F\\land$, and Floyd–Warshall becomes **Warshall's transitive-closure**\nalgorithm. Let $r_k[i][j]$ be true iff $j$ is reachable from $i$ using\nintermediate vertices in $\\{1,\\dots,k\\}$:\n\n$$\nr_k[i][j] = r_{k-1}[i][j]\\ \\lor\\ \\big(r_{k-1}[i][k]\\ \\land\\ r_{k-1}[k][j]\\big).\n$$\n\nSame triple loop, same $O(V^3)$, same in-place collapse of the $k$ index; only\nthe semiring changed (booleans under or\u002Fand instead of reals under min\u002Fplus).\n_Course Schedule IV_ is this exactly: prerequisites form a DAG, and each query\n\"is course $a$ a prerequisite of course $b$?\" is a lookup in the reachability\nmatrix $r_V$.\n\n## Held–Karp: a subset as the resource\n\nThe resource need not be a single number. In **Held–Karp** bitmask TSP (the\n[Bitmask DP](\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp) lesson), the subproblem\nis $D[S][v]$ = the cheapest path starting at the origin, visiting exactly the\nvertex set $S$, and ending at $v$; the transition relaxes over the last hop\n$D[S][v] = \\min_{u \\in S\\setminus\\{v\\}} D[S\\setminus\\{v\\}][u] + w(u,v)$. The\nrationed resource is the **subset of visited vertices**, grown one vertex per\nlayer, the same skeleton as Floyd–Warshall, with $2^V$ subsets in place of $V$\nintermediate-vertex levels. _Shortest Path Visiting All Nodes_ is the unweighted\ncousin: a BFS over $(\\text{mask}, v)$ states, where the mask is again the\nresource. The DP-on-graphs lens scales from one scalar of slack all the way up to\nan exponential subset.\n\n## Choosing the framing\n\nAll four are DP, but the right resource depends on the graph:\n\n- **Floyd–Warshall**: dense, all-pairs, negative edges allowed; $O(V^3)$ time,\n  $O(V^2)$ space. The default when you need _every_ pair.\n- **$V\\times$ Dijkstra**: sparse graphs with **non-negative** weights;\n  $O(V(E + V\\log V))$, which beats $V^3$ when $E \\ll V^2$.\n- **Bellman–Ford**: single-source with **negative edges**, negative-cycle\n  detection, or an **edge-count cap** ($K$-stops); $O(VE)$.\n- **DAG-DP**: acyclic graphs; $O(V+E)$, handles negative weights and even\n  longest paths, because topological order removes the need to iterate to\n  convergence.\n\n## Takeaways\n\n- **Many graph algorithms are dynamic programs.** The subproblem is the _best\n  value under a restricted resource_ (intermediate vertices, edges, a\n  topological prefix, or a visited subset), and **edge relaxation is the DP\n  transition**.\n- **Floyd–Warshall** is the archetype: $d_k[i][j]=\\min(d_{k-1}[i][j],\\,\n  d_{k-1}[i][k]+d_{k-1}[k][j])$, route through $k$ or don't, collapsing in\n  place to $O(V^3)$ time, $O(V^2)$ space; negative edges OK, and $d[i][i]\u003C0$\n  flags a negative cycle.\n- **Bellman–Ford** is a DP over path length, $D_t[v]$ for at-most-$t$ edges;\n  $V-1$ rounds converge, an extra relaxation detects a negative cycle, and\n  capping $t$ at $K+1$ solves **Cheapest Flights Within K Stops** ($O(VE)$).\n- **DAG-DP** processes vertices in **topological order** for an $O(V+E)$ single\n  pass, shortest _or_ longest path, and **counting (shortest) paths** by\n  carrying a count alongside the distance.\n- **Warshall's transitive closure** is the boolean Floyd–Warshall\n  ($\\lor\u002F\\land$), giving reachability, exactly **Course Schedule IV**.\n- The resource can be a **subset** (Held–Karp \u002F bitmask TSP), unifying scalar\n  shortest paths with exponential-state DP under one frame.\n\n[^erickson-dp]: **Erickson**, Ch. — Dynamic Programming: the DP recipe is to define the subproblem, write the recurrence, and evaluate in an order respecting the dependency DAG.\n[^clrs-fw]: **CLRS**, Ch. 23 — All-Pairs Shortest Paths (§23.2): Floyd–Warshall's intermediate-vertex recurrence, $\\Theta(V^3)$ in-place evaluation, and negative-cycle detection via $d[i][i]\u003C0$.\n[^clrs-bf]: **CLRS**, Ch. 22 — Single-Source Shortest Paths: Bellman–Ford relaxes all edges $V-1$ times; a further relaxation reveals a negative cycle.\n[^skiena-dag]: **Skiena**, § — Shortest Paths \u002F DP: shortest and longest paths on a DAG in $O(V+E)$ by relaxing edges in topological order; longest path is NP-hard only in general graphs.\n",{"text":9899,"minutes":9900,"time":9901,"words":9902},"9 min read",8.565,513900,1713,{"title":281,"description":9878},[9905,9907,9909],{"book":9655,"ref":9906},"Ch. 23 — All-Pairs Shortest Paths (§23.2 Floyd–Warshall)",{"book":9814,"ref":9908},"§ — Shortest Paths \u002F DP",{"book":9641,"ref":9910},"Ch. — Dynamic Programming","available","01.algorithms\u002F08.dynamic-programming\u002F10.dp-on-graphs",[231],"NHGQW_4GQxAhfWr-cYDFvqkubAQ-gGC-zfk9kXDgShw",{"\u002Falgorithms\u002Ffoundations\u002Fwhat-is-an-algorithm":9916,"\u002Falgorithms\u002Ffoundations\u002Fasymptotic-analysis":9917,"\u002Falgorithms\u002Ffoundations\u002Frecurrences":9918,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fmergesort":9919,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fquicksort":9920,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fselection":9921,"\u002Falgorithms\u002Fsorting\u002Fheaps-and-heapsort":9922,"\u002Falgorithms\u002Fsorting\u002Fsorting-lower-bounds":9923,"\u002Falgorithms\u002Fsorting\u002Flinear-time-sorting":9924,"\u002Falgorithms\u002Fdata-structures\u002Felementary-structures":9925,"\u002Falgorithms\u002Fdata-structures\u002Fhash-tables":9926,"\u002Falgorithms\u002Fdata-structures\u002Fbinary-search-trees":9927,"\u002Falgorithms\u002Fdata-structures\u002Favl-trees":9928,"\u002Falgorithms\u002Fdata-structures\u002Fbalanced-trees":9929,"\u002Falgorithms\u002Fdata-structures\u002Funion-find":9930,"\u002Falgorithms\u002Fdata-structures\u002Ffenwick-and-segment-trees":9931,"\u002Falgorithms\u002Fsequences\u002Ftwo-pointers-and-windows":9932,"\u002Falgorithms\u002Fsequences\u002Fmonotonic-stacks":9933,"\u002Falgorithms\u002Fsequences\u002Fbinary-search-on-the-answer":9934,"\u002Falgorithms\u002Fsequences\u002Fstring-matching":9935,"\u002Falgorithms\u002Fsequences\u002Ftries":9936,"\u002Falgorithms\u002Fgraphs\u002Frepresentations-and-traversal":9937,"\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc":9938,"\u002Falgorithms\u002Fgraphs\u002Fminimum-spanning-trees":9939,"\u002Falgorithms\u002Fgraphs\u002Fshortest-paths":9940,"\u002Falgorithms\u002Fgraphs\u002Fnetwork-flow":9941,"\u002Falgorithms\u002Fgraphs\u002Fbridges-and-articulation-points":9942,"\u002Falgorithms\u002Fgraphs\u002Flowest-common-ancestor":9943,"\u002Falgorithms\u002Fgraphs\u002Ftwo-sat":9944,"\u002Falgorithms\u002Fgraphs\u002Feulerian-tours":9945,"\u002Falgorithms\u002Fgreedy\u002Fthe-greedy-method":9946,"\u002Falgorithms\u002Fgreedy\u002Fscheduling-and-intervals":9947,"\u002Falgorithms\u002Fgreedy\u002Fhuffman-codes":9948,"\u002Falgorithms\u002Fgreedy\u002Fmatroids":9949,"\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples":9950,"\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp":9951,"\u002Falgorithms\u002Fdynamic-programming\u002Flongest-increasing-subsequence":9952,"\u002Falgorithms\u002Fdynamic-programming\u002Fknapsack":9953,"\u002Falgorithms\u002Fdynamic-programming\u002Fcoin-change-and-unbounded":9954,"\u002Falgorithms\u002Fdynamic-programming\u002Finterval-dp":9955,"\u002Falgorithms\u002Fdynamic-programming\u002Ftree-dp":9956,"\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp":9957,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-optimizations":9958,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs":9902,"\u002Falgorithms\u002Fbacktracking\u002Fbacktracking-fundamentals":9959,"\u002Falgorithms\u002Fbacktracking\u002Fconstraint-search":9960,"\u002Falgorithms\u002Fbacktracking\u002Fbranch-and-bound":9961,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fnumber-theory-basics":9932,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fmodular-exponentiation-and-primality":9962,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fsieve-and-factorization":9963,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fcombinatorics":9964,"\u002Falgorithms\u002Fcomputational-geometry\u002Fgeometric-primitives":9965,"\u002Falgorithms\u002Fcomputational-geometry\u002Fconvex-hull":9948,"\u002Falgorithms\u002Fcomputational-geometry\u002Fsweep-line":9966,"\u002Falgorithms\u002Fintractability\u002Fp-np-reductions":9967,"\u002Falgorithms\u002Fintractability\u002Fnp-completeness":9928,"\u002Falgorithms\u002Fintractability\u002Fcoping-with-hardness":9968,"\u002Falgorithms":9969,"\u002Ftheory-of-computation":9970,"\u002Fcomputer-architecture":9970,"\u002Fphysical-computing":9970,"\u002Fdatabases":9970,"\u002Fdeep-learning":9970},1763,2107,1738,2628,1723,2048,1697,1044,1542,1565,1679,1586,1388,1465,1971,1455,1533,1483,1578,1791,1481,2704,1658,2070,1978,2080,1568,1451,1291,1543,1883,1443,1599,2038,2241,1744,1678,2288,1929,1657,1412,1554,1418,1798,1694,1762,1534,1595,1262,1495,1630,2306,2142,107,0,{"\u002Falgorithms\u002Ffoundations\u002Fwhat-is-an-algorithm":9972,"\u002Falgorithms\u002Ffoundations\u002Fasymptotic-analysis":9973,"\u002Falgorithms\u002Ffoundations\u002Frecurrences":9974,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fmergesort":9975,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fquicksort":9976,"\u002Falgorithms\u002Fdivide-and-conquer\u002Fselection":9977,"\u002Falgorithms\u002Fsorting\u002Fheaps-and-heapsort":9978,"\u002Falgorithms\u002Fsorting\u002Fsorting-lower-bounds":9979,"\u002Falgorithms\u002Fsorting\u002Flinear-time-sorting":9980,"\u002Falgorithms\u002Fdata-structures\u002Felementary-structures":9981,"\u002Falgorithms\u002Fdata-structures\u002Fhash-tables":9982,"\u002Falgorithms\u002Fdata-structures\u002Fbinary-search-trees":9983,"\u002Falgorithms\u002Fdata-structures\u002Favl-trees":9984,"\u002Falgorithms\u002Fdata-structures\u002Fbalanced-trees":9985,"\u002Falgorithms\u002Fdata-structures\u002Funion-find":9986,"\u002Falgorithms\u002Fdata-structures\u002Ffenwick-and-segment-trees":9987,"\u002Falgorithms\u002Fsequences\u002Ftwo-pointers-and-windows":9988,"\u002Falgorithms\u002Fsequences\u002Fmonotonic-stacks":9989,"\u002Falgorithms\u002Fsequences\u002Fbinary-search-on-the-answer":9990,"\u002Falgorithms\u002Fsequences\u002Fstring-matching":9991,"\u002Falgorithms\u002Fsequences\u002Ftries":9992,"\u002Falgorithms\u002Fgraphs\u002Frepresentations-and-traversal":9993,"\u002Falgorithms\u002Fgraphs\u002Ftopological-sort-and-scc":9994,"\u002Falgorithms\u002Fgraphs\u002Fminimum-spanning-trees":9995,"\u002Falgorithms\u002Fgraphs\u002Fshortest-paths":9996,"\u002Falgorithms\u002Fgraphs\u002Fnetwork-flow":9997,"\u002Falgorithms\u002Fgraphs\u002Fbridges-and-articulation-points":9998,"\u002Falgorithms\u002Fgraphs\u002Flowest-common-ancestor":9999,"\u002Falgorithms\u002Fgraphs\u002Ftwo-sat":10000,"\u002Falgorithms\u002Fgraphs\u002Feulerian-tours":10001,"\u002Falgorithms\u002Fgreedy\u002Fthe-greedy-method":10002,"\u002Falgorithms\u002Fgreedy\u002Fscheduling-and-intervals":10003,"\u002Falgorithms\u002Fgreedy\u002Fhuffman-codes":10004,"\u002Falgorithms\u002Fgreedy\u002Fmatroids":10005,"\u002Falgorithms\u002Fdynamic-programming\u002Fprinciples":10006,"\u002Falgorithms\u002Fdynamic-programming\u002Fsequence-dp":10007,"\u002Falgorithms\u002Fdynamic-programming\u002Flongest-increasing-subsequence":10008,"\u002Falgorithms\u002Fdynamic-programming\u002Fknapsack":10009,"\u002Falgorithms\u002Fdynamic-programming\u002Fcoin-change-and-unbounded":10010,"\u002Falgorithms\u002Fdynamic-programming\u002Finterval-dp":10011,"\u002Falgorithms\u002Fdynamic-programming\u002Ftree-dp":10012,"\u002Falgorithms\u002Fdynamic-programming\u002Fbitmask-dp":10013,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-optimizations":10014,"\u002Falgorithms\u002Fdynamic-programming\u002Fdp-on-graphs":10015,"\u002Falgorithms\u002Fbacktracking\u002Fbacktracking-fundamentals":10016,"\u002Falgorithms\u002Fbacktracking\u002Fconstraint-search":10017,"\u002Falgorithms\u002Fbacktracking\u002Fbranch-and-bound":10018,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fnumber-theory-basics":10019,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fmodular-exponentiation-and-primality":10020,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fsieve-and-factorization":10021,"\u002Falgorithms\u002Fmathematical-algorithms\u002Fcombinatorics":10022,"\u002Falgorithms\u002Fcomputational-geometry\u002Fgeometric-primitives":10023,"\u002Falgorithms\u002Fcomputational-geometry\u002Fconvex-hull":10024,"\u002Falgorithms\u002Fcomputational-geometry\u002Fsweep-line":10025,"\u002Falgorithms\u002Fintractability\u002Fp-np-reductions":10026,"\u002Falgorithms\u002Fintractability\u002Fnp-completeness":10027,"\u002Falgorithms\u002Fintractability\u002Fcoping-with-hardness":10028,"\u002Falgorithms":10029,"\u002Ftheory-of-computation":10032,"\u002Fcomputer-architecture":10035,"\u002Fphysical-computing":10038,"\u002Fdatabases":10041,"\u002Fdeep-learning":10044},{"path":11,"title":10,"module":5,"summary":14},{"path":17,"title":16,"module":5,"summary":20},{"path":23,"title":22,"module":5,"summary":27},{"path":34,"title":33,"module":29,"summary":37},{"path":40,"title":39,"module":29,"summary":43},{"path":46,"title":45,"module":29,"summary":49},{"path":56,"title":55,"module":51,"summary":59},{"path":62,"title":61,"module":51,"summary":64},{"path":67,"title":66,"module":51,"summary":70},{"path":78,"title":77,"module":72,"summary":81},{"path":84,"title":83,"module":72,"summary":87},{"path":90,"title":89,"module":72,"summary":92},{"path":95,"title":94,"module":72,"summary":98},{"path":101,"title":100,"module":72,"summary":104},{"path":107,"title":106,"module":72,"summary":112},{"path":115,"title":114,"module":72,"summary":119},{"path":126,"title":125,"module":121,"summary":129},{"path":132,"title":131,"module":121,"summary":134},{"path":137,"title":136,"module":121,"summary":140},{"path":143,"title":142,"module":121,"summary":146},{"path":149,"title":148,"module":121,"summary":151},{"path":158,"title":157,"module":153,"summary":162},{"path":165,"title":164,"module":153,"summary":167},{"path":170,"title":169,"module":153,"summary":172},{"path":175,"title":174,"module":153,"summary":177},{"path":180,"title":179,"module":153,"summary":182},{"path":185,"title":184,"module":153,"summary":187},{"path":190,"title":189,"module":153,"summary":192},{"path":195,"title":194,"module":153,"summary":198},{"path":201,"title":200,"module":153,"summary":204},{"path":211,"title":210,"module":206,"summary":213},{"path":216,"title":215,"module":206,"summary":219},{"path":222,"title":221,"module":206,"summary":224},{"path":227,"title":226,"module":206,"summary":229},{"path":236,"title":235,"module":231,"summary":238},{"path":241,"title":240,"module":231,"summary":244},{"path":247,"title":246,"module":231,"summary":249},{"path":252,"title":251,"module":231,"summary":254},{"path":257,"title":256,"module":231,"summary":259},{"path":262,"title":261,"module":231,"summary":264},{"path":267,"title":266,"module":231,"summary":269},{"path":272,"title":271,"module":231,"summary":274},{"path":277,"title":276,"module":231,"summary":279},{"path":282,"title":281,"module":231,"summary":285},{"path":292,"title":291,"module":287,"summary":295},{"path":298,"title":297,"module":287,"summary":300},{"path":303,"title":302,"module":287,"summary":305},{"path":312,"title":311,"module":307,"summary":315},{"path":318,"title":317,"module":307,"summary":320},{"path":323,"title":322,"module":307,"summary":325},{"path":328,"title":327,"module":307,"summary":330},{"path":338,"title":337,"module":332,"summary":341},{"path":344,"title":343,"module":332,"summary":346},{"path":349,"title":348,"module":332,"summary":351},{"path":359,"title":358,"module":353,"summary":362},{"path":364,"title":361,"module":353,"summary":366},{"path":369,"title":368,"module":353,"summary":373},{"path":10030,"title":10031,"module":376,"summary":376},"\u002Falgorithms","Algorithms",{"path":10033,"title":10034,"module":376,"summary":376},"\u002Ftheory-of-computation","Theory of Computation",{"path":10036,"title":10037,"module":376,"summary":376},"\u002Fcomputer-architecture","Computer Architecture",{"path":10039,"title":10040,"module":376,"summary":376},"\u002Fphysical-computing","Physical Computing",{"path":10042,"title":10043,"module":376,"summary":376},"\u002Fdatabases","Databases",{"path":10045,"title":10046,"module":376,"summary":376},"\u002Fdeep-learning","Deep Learning",1781560526930]