Update for 28-09-22 16:45
This commit is contained in:
parent
f6d480141a
commit
40d8f9fdf9
BIN
Ideas.md.gpg
BIN
Ideas.md.gpg
Binary file not shown.
28
tech/Bellman-Ford.wiki
Normal file
28
tech/Bellman-Ford.wiki
Normal file
@ -0,0 +1,28 @@
|
||||
= Bellman Ford =
|
||||
|
||||
Bellman ford is an algorithm for finding the shortest path from some node to
|
||||
all other nodes in a weighted graph
|
||||
|
||||
== PsuedoCode ==
|
||||
|
||||
Input: directed graph _G=(V,E)_;
|
||||
Edge lengths contained in the set _E_ with no negative cycles; Edge is _e_;
|
||||
_s_ contained in _V_;
|
||||
|
||||
Output: For all verticies _u_ reachable from _s_, `dist(u)` is set to the
|
||||
distance from _s_ to _u_
|
||||
|
||||
{{{
|
||||
for all u in V:
|
||||
dist(u) = inf
|
||||
prev(u) = null
|
||||
|
||||
dist(s) = 0
|
||||
repeat |V| - 1 times:
|
||||
for all e contained in E:
|
||||
update(e)
|
||||
|
||||
update((u,v) in e):
|
||||
dist(v) = min(dist(v), dist(u) + length of dist between u and v)
|
||||
|
||||
}}}
|
@ -39,6 +39,7 @@ Different ways to store and operate on data, with differing efficiency
|
||||
* [[BFS]]
|
||||
* [[DFS]]
|
||||
* [[Dijkstra]]
|
||||
* [[Bellman-Ford]]
|
||||
|
||||
=== Strings ===
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user