|
|
|
| Web Hosting Guide |
Floyd - Warshall - Shortest Path Graphs, description of Floyd - Warshall and its uses in graghs |
Dec 16 2007, 07:44 AM
Post
#1
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 19 Joined: 14-December 07 From: Mexico Member No.: 26,890 |
Floyd - Warshall
The Floyd - Warshall algorithm is used to find the shortest path between all nodes in a directed graph with weights in its connections. A single run of the algorithm will find the shortest path between any pair of nodes in the graph with a complexity time of O(V^3), where V is the number of nodes of the graph. This complexity time is due to the 3 cycles it uses in its implementation. The algorithm works by estimating the cost of the shortest path between nodes and it corrects its answer in each iteration. Let's suppose that we have a graph with V nodes, all numbered from 1 to N. The shortest path between node 'i' and node 'j' could be one of the followings: - The path between "i" and "j" or - The path between "i" and "k" plus the shortest path between "k" and "j", where "k: is the intermediate node smaller than N In other words these two statements could be written as pseudo code: shortestPath_i_to_j = min(shortestPath(i, j), shortestPath(j, k) + shortestPath(k, i)); And the complete pseudo code is: procedure FloydWarshall () Assume that N is the number of nodes in the graph and that each element of the path[i][j] has been initialize with the cost of traveling from i to j, normally using an adjacency matrix. For numerically meaningful output, Floyd-Warshall assumes that there are no negative cycles (in fact, between any pair of vertices which form part of a negative cycle, the shortest path is not well-defined). Nevertheless, if there are negative cycles, Floyd–Warshall can be used to detect them: either run one more iteration and see if there are any changes, or look for negative values in the diagonal. Some of its applications and problems were it could be applied are - Shortest paths in directed graphs. - Transitive closure of directed graphs. In Warshall's original formulation of the algorithm, the graph is unweighted and represented by a Boolean adjacency matrix. Then the addition operation is replaced by logical conjunction (AND) and the minimum operation by logical disjunction (OR). - Finding a regular expression denoting the regular language accepted by a finite automaton (Kleene's algorithm) (sound complex? yes!) - Inversion of real matrices (Gauss-Jordan algorithm). - Optimal routing. In this application one is interested in finding the path with the maximum flow between two vertices. This means that, rather than taking minima as in the pseudocode above, one instead takes maxima. The edge weights represent fixed constraints on flow. Path weights represent bottlenecks; so the addition operation above is replaced by the minimum operation. - Testing whether an undirected graph is bipartite. Hope this was useful to understand the algorithm and that you will be able to apply this algorithm in solving problems. |
|
|
|
Posts in this topic
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
0 | dangerdan | 236 | 7th June 2009 - 04:56 PM Last post by: dangerdan |
|||
![]() |
9 | Alex Ross | 2,319 | 16th May 2009 - 07:05 AM Last post by: seunbanks |
|||
![]() |
9 | whistle | 10,387 | 8th September 2008 - 05:01 PM Last post by: Guest |
|||
![]() |
2 | garga1 | 1,815 | 4th September 2008 - 11:57 AM Last post by: magiccode9 |
|||
![]() |
8 | ProtoMan.EXE | 2,781 | 23rd November 2007 - 06:17 PM Last post by: vujsa |
|||
![]() |
1 | lorenza pietersen | 1,282 | 25th September 2006 - 12:57 PM Last post by: Mark420 |
|||
![]() |
0 | sumaru | 629 | 2nd June 2006 - 04:27 AM Last post by: sumaru |
|||
![]() |
3 | Casanova | 3,687 | 11th November 2005 - 11:17 AM Last post by: finaldesign |
|||
![]() |
6 | brouzine | 1,341 | 26th January 2005 - 08:53 AM Last post by: taurus3564 |
|||
![]() |
2 | honmore | 1,201 | 6th September 2004 - 05:42 AM Last post by: wizzywig |
|||
|
Lo-Fi Version | Time is now: 22nd March 2010 - 03:41 PM |
© 2010 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation


Dec 16 2007, 07:44 AM






