Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2K views

Bridge - Algorithm

BRIDGE In graph theory, a bridge (also known as a cut-edge or cut arc or an isthmus) is an edge whose deletion increases the number of connected components. Equivalently, an edge is a bridge if and only if it is not contained in any cycle. A graph is said to be bridgeless if it contains no bridges. It is easy to see that this is equivalent to 2-edge-connectivity of each nontrivial component. A graph with 6 bridges (highlighted in red) Bridge-Finding Algorithm An O( | V | + | E | ) algorithm f

Uploaded by

тнє Sufi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Bridge - Algorithm

BRIDGE In graph theory, a bridge (also known as a cut-edge or cut arc or an isthmus) is an edge whose deletion increases the number of connected components. Equivalently, an edge is a bridge if and only if it is not contained in any cycle. A graph is said to be bridgeless if it contains no bridges. It is easy to see that this is equivalent to 2-edge-connectivity of each nontrivial component. A graph with 6 bridges (highlighted in red) Bridge-Finding Algorithm An O( | V | + | E | ) algorithm f

Uploaded by

тнє Sufi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

c 

In graph theory, a à  (also known as a cut-edge or cut arc or an isthmus) is an edge whose
deletion increases the number of connected components. Equivalently, an edge is a bridge if and
only if it is not contained in any cycle.

A graph is said to be à  if it contains no bridges. It is easy to see that this is equivalent to
2-edge-connectivity of each nontrivial component.

A graph with 6 bridges (highlighted in red)


c  

   
An ½( | | + |  | ) algorithm for finding bridges in a connected graph was found by Tarjan in
1974. A distributed version of the algorithm also exists

Algorithm:

1.Y ind a spanning tree of


2.Y èreate a rooted tree  from the spanning tree
3.Y Traverse the tree  in preorder and number the nodes. Parent nodes in the tree now have
lower numbers than child nodes.
4.Y or each node from 31 (the leaf nodes of the tree) to 1 (the root node of the tree) do:
1.Y èompute the number of descendants - (3) for this node.
2.Y èompute D(3) and (3)
3.Y or each d such that : if and (d) <d + - (d) then (3,d) is
a bridge.

Definitions: A non-tree edge between 3 and d is denoted by 3 í í d. An in-tree edge with 3 as


the parent is denoted by .

where3 is the parent node of d.

- (3) is the number of descendants of v (including itself) in the rooted spanning tree.

D(3) and (3) are the labels of the nodes with lowest and highest preorder label respectively
reachable from v by travelling in the subtree rooted at v, along with at most one non-tree edge.

This algorithm works because D (3), (3) and D(3) can all be computed for a node v provided
we know their values on all in-tree descendants of v. Also, if and only if the edge is a
bridge, then it is clear that in the subtree rooted at d, it must be impossible to reach any node that
is not a descendant of w. This is easy to check because the subtree rooted at w (that is, all
descendants of w) consists of the nodes so we can
simply check if D(d),(d) are in this set or not to check whether an edge is a bridge.
c 

  
The motivation is to decouple the Time interface from the Time implementation, while still allowing the
abstraction and the realization to each be modelled with their own inheritance hierarchy. The
implementation classes below are straight-forward. The interface classes are a little more subtle.
Routinely, a Bridge pattern interface hierarchy ͞hasa͟ implementation class. Here the interface base
class ͞hasa͟ a pointer to the implementation base class, and each class in the interface hierarchy is
responsible for populating the base class pointer with the correct concrete implementation class. Then
all requests from the client are simply delegated by the interface class to the encapsulated
implementation class.

è 
w 
 
w    
w 




 
 
       
  
  

   
  ! 
!
 "#
 $ %&  

  
   




'     


 
'              
$

(" )!*)!



(" )!+)!


,-  -,
 
  ! 
! !! " )

  
 " ).%/




0   


 
0         1    
$1 2

(1 !3
 4   !

 $1 5

(1 !' 4   !




,-  -,
 
  ! 
!
 "#
 $ %&  1 


  
 1 .67/




 
 
 
       
 "   

   
 8 

  
 - 




'     


 
'           
 "'     





0   


 
0         1 
 "0   1 



  
 - 
.6/

.7/" 9%67

.9/"'   #679

.#/"0 9%675
$    7 6 ::

. /8 


You might also like