Critical edges:
Given:
be a connected undirected graph. We say an edge
is critical if removing it disconnects the graph.
Want:
Given an algorithm for identifying all critical edges.
Solve:
Fun DFS on G to get a single tree T.
1. non-tree edges cannot be critical
This is because the tree keeps the graph connected even if all non-tree edges are removed. This reduced the search space for critical edges from
to just
.
Let
be the set of descendants of
in T, consider
to be a descendant of itself, so
. Using the discovery times of DFS define for every vertex
:
![Rendered by QuickLaTeX.com \text{low}[u] = min \left\{ \begin{array}{cc} \text{d}[w] & | (x,w)\text{ is a non-tree edge and }x\in D_u\\ \text{d}[u] \end{array} \right.](http://cassiechen.com/wp-content/ql-cache/quicklatex.com-46d24fefd820c2d9208e137a5c52c11a_l3.png)
Recall DFS tree of an undirected graph, all non-tree edges connect 2 nodes such that one is the descendant of the other. So
captures how high up the tree we can go from u by taking zero or more edges down the tree followed by a single non-tree edge to reach a node
up in the tree.
In order to keep
well defined (in case that no non-tree edge exists), we also consider the option of staying at
. The discovery time of the vertices decreases as we go up the tree we take the minimum of the discovery times of the vertices before mentioned.
We now claim that a tree edge
, where
is
‘s parent, is a critical edge if and only if
. The only way to remain connected is through a non-tree edge
where
and
.
In that case, we know that
. Otherwise, if no such edge exists, we have
and removing
disconnects the graph.
We could identify all critical vertices in
time if we had these low values.
To pre-compute
,
for each vertex
in
time. Then we can compute low by using the following relation:
,
which would take
for each
.
Thus computing
for all
would take
time.
NOW, to get a more efficient algorithm we need to re-use come computation. This can be done if we re-difine
recursively:
.
The two definitions are clearly equivalent, but the second one leads immediately to a
algorithm for computing
for all
, provided
is given for all
.
So this approach takes
time.

Your answer was just what I nedeed. It’s made my day!
i have poblrem with your algorithm, i have list like
$this->graph_arr = array();$n = new Node(“15″, array(“36″, “211″));
array_push($this->graph_arr, $n);$n = new Node(“32″, array(“15″, “199″));
array_push($this->graph_arr, $n);
//$n = new Node(“36″, array(“49″,“50″,”32″,”486″,”542″,”328″,”561″,”1141″,”653″,”654″,”512″,”80″,”800″));$n = new Node(“36″, array(“32″,”49″, “80″,”328″,”486″,”512″,”542″,”561″,”653″,”654″,”800″,”1141″));
array_push($this->graph_arr, $n);//$n = new Node(“49″, array(“1141″, “542″,”36″,”1153″));
$n = new Node(“49″, array(“36″, “542″,”1141″,”1153″));
array_push($this->graph_arr, $n);$n = new Node(“328″, array(“49″, “653″));
array_push($this->graph_arr, $n);
//$n = new Node(“542″, array(“1141″, “50″));$n = new Node(“542″, array(“50″, “1141″));
array_push($this->graph_arr, $n);//$n = new Node(“653″, array(“654″, “50″));$n = new Node(“653″, array(“50″, “654″));
array_push($this->graph_arr, $n);$n = new Node(“800″, array(“801″, “802″));
array_push($this->graph_arr, $n);i have clalled in main php like$graph = new Graph();echo “”;$graph->printGraph($graph->getGraph());echo “———————————- ”;
//$graph->getAdjacentNodes();
//$graph->dfs(@$_GET['s'], @$_GET['f']);
//$graph->dfs_recursive(@$_GET['s'], @$_GET['f']);
//$graph->dfs_recursive(36,802);
//$graph->dfs_recursive(36,50);
//$graph->dfs_recursive(’36′,’50′);
//$graph->dfs_recursive(’36′,’653′);$graph->dfs_recursive(32,542);$graph->printDfsSolution();
but in line $finish_node_name = $this->getNode($finish_node_name);
i bekomme empty $finish_node_name
why!!