Hopcroft-Tarjan: Difference between revisions
(Created page with "== Abstract view == '''Algorithmic problem:''' Biconnected components '''Type of algorithm:''' two steps. == Step 1 == '''Abstract view:''' A variation of Depth-firs...") |
(→Step 1) |
||
Line 16: | Line 16: | ||
'''Implementation:''' | '''Implementation:''' | ||
# The DFS maintains a global integral number, the '''current depth'''. Whenever a node is seen for the first time, its depth attribute is set identical to the current depth. In each forward step, the current depth is ''in''creased by one, in each backward step, it is ''de''creased by one. | # The DFS maintains a global integral number, the '''current depth'''. Whenever a node is seen for the first time, its depth attribute is set identical to the current depth. In each forward step, the current depth is ''in''creased by one, in each backward step, it is ''de''creased by one. | ||
# Whenever a node <math>v\in V</math> is seen for the first time, its lowpoint is set identical to its depth. Whenever an arc <math>(v,w)</math> is examined such that <math>w</math> has already been seen and the depth of <math>w</math> is smaller than the lowpoint of <math>v</math>, the lowpoint of <<math> is | # Whenever a node <math>v\in V</math> is seen for the first time, its lowpoint is set identical to its depth. Whenever an arc <math>(v,w)</math> is examined such that <math>w</math> has already been seen and the depth of <math>w</math> is smaller than the lowpoint of <math>v</math>, the lowpoint of <math>w<math> is set identical to the depth of <math>w</math>. | ||
== Step 2 == | == Step 2 == |
Revision as of 12:49, 30 October 2014
Abstract view
Algorithmic problem: Biconnected components
Type of algorithm: two steps.
Step 1
Abstract view: A variation of DFS, where for each node [math]\displaystyle{ v\in v }[/math] two additional nonnegative integral numbers are computed:
- The 'depth of [math]\displaystyle{ v }[/math] in the arborescence created by the DFS procedure.
- The lowpoint, that is, the minimal depth of any node [math]\displaystyle{ w/in V }[/math] such that [math]\displaystyle{ (u,w)\in A }[/math] for some immediate or non-immediate successor of [math]\displaystyle{ v }[/math] in the DFS tree.
Implementation:
- The DFS maintains a global integral number, the current depth. Whenever a node is seen for the first time, its depth attribute is set identical to the current depth. In each forward step, the current depth is increased by one, in each backward step, it is decreased by one.
- Whenever a node [math]\displaystyle{ v\in V }[/math] is seen for the first time, its lowpoint is set identical to its depth. Whenever an arc [math]\displaystyle{ (v,w) }[/math] is examined such that [math]\displaystyle{ w }[/math] has already been seen and the depth of [math]\displaystyle{ w }[/math] is smaller than the lowpoint of [math]\displaystyle{ v }[/math], the lowpoint of [math]\displaystyle{ w\lt math\gt is set identical to the depth of \lt math\gt w }[/math].
Step 2
Abstract view: A repeated application of DFS, where the start nodes of the individual DFS runs are exactly those nodes [math]\displaystyle{ v\in V }[/math] for which the lowpoint of [math]\displaystyle{ v }[/math] is not smaller than the depth of [math]\displaystyle{ v }[/math]. These nodes are considered in ascending order of their finishing times as computed in step 1. The nodes hit in a DFS run are removed from [math]\displaystyle{ G }[/math] before the next DFS run commences. The node sets visited in the individual DFS runs are the biconnected components.