Algorithm Gym :: Graph Algorithms Welcome to the new episode of [user:PrinceOfPersia,2015-01-31] presents: Fun with algorithms ;)
You can find all the definitions here in the book "Introduction to graph theory", Douglas.B West.
[cut]
Important graph algorithms :
DFS
---
The most useful graph algorithms are search algorithms. DFS (Depth First Search) is one of them.
While running DFS, we assign colors to the vertices (initially white). Algorithm itself is really simple :
~~~~~
dfs (v):
color[v] = gray
for u in adj[v]:
if color[u] == white
then dfs(u)
color[v] = black
~~~~~
Black color here is not used, but you can use it sometimes.
Time complexity : $O(n + m)$.
#### DFS tree
DFS tree is a rooted tree that is built like this :
~~~~~
let T be a new tree
dfs (v):
color[v] = gray
for u in adj[v]:
if color[u] == white
then dfs(u) and par[u] = v (in T)
...
Algorithm Gym :: Graph Algorithms, #### Dinic's algorithm, ). You can prove this algorithm using induction., **Six) Tarjan's algorithm $O(n a(n))$ ($a(n)$ is the inverse ackermann
function)**, BFS is another search algorithm (Breadth First Search). It is usually used to
calculate the, Bellman-Ford is an algorithm for single source shortest path where edges can be
negative (but if, Each algorithm has complexities $$, it means that this algorithm's preprocess is, Floyd-Warshal algorithm is an all-pairs shortest path algorithm using dynamic
programming., For this propose we can use RMQ problem, and the best algorithm for that, is to
use Sparse table., Here is Dinic's algorithm as you wanted., In this algorithm, first of all we run DFS on the graph and sort the vertices
in decreasing of, In this algorithm, first we sort the edges in ascending order of their weight
in an array of edges., SPFA (Shortest Path Faster Algorithm) is a fast and simple algorithm (single
source) that its, Tarjan's algorithm is offline; that is, unlike other lowest common ancestor
algorithms, it requires, The most useful and fast-coding algorithm for finding SCCs is Kosaraju., The origin of this algorithm is unknown. It's said that at first Chinese coders
used it in, This algorithm is a single source shortest path (from one source to any other
vertices). Pay, This is the most useful and simple (among fast algorithms) algorithm., While running DFS, we assign colors to the vertices (initially white). Algorithm
itself is really
Full text and comments »