This action might not be possible to undo. Are you sure you want to continue?

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

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 for finding bridges in a connected graph was found by Tarjan in 1974. A distributed version of the algorithm also exists Algorithm: 1. Find a spanning tree of G 2. Create a rooted tree T from the spanning tree 3. Traverse the tree T in preorder and number the nodes. Parent nodes in the tree now have lower numbers than child nodes. 4. For each node from v1 (the leaf nodes of the tree) to 1 (the root node of the tree) do: 1. Compute the number of descendants ND(v) for this node. 2. Compute L(v) and H(v) 3. For each w such that a bridge. : if and H(w) <w + ND(w) then (v,w) is

Definitions: A non-tree edge between v and w is denoted by v í í w. An in-tree edge with v as the parent is denoted by .

wherev is the parent node of w. ND(v) is the number of descendants of v (including itself) in the rooted spanning tree.

L(v) and H(v) 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 LD(v), H(v) and L(v) 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 w, 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 L(w),H(w) are in this set or not to check whether an edge is a bridge.

**Bridge design pattern demo
**

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.

Code:

#include <iostream.h> #include <iomanip.h> #include <string.h> classTimeImp { public: TimeImp(inthr, int min) { hr_ = hr; min_ = min; } virtual void tell() { cout<< "time is " <<setw(2) <<setfill(48) <<hr_ << min_ <<endl; } protected: inthr_, min_; }; classCivilianTimeImp: public TimeImp { public: CivilianTimeImp(inthr, int min, int pm): TimeImp(hr, min) { if (pm) strcpy(whichM_, " PM"); else strcpy(whichM_, " AM"); } /* virtual */ void tell() { cout<< "time is " <<hr_ << ":" << min_ <<whichM_ <<endl; } protected: charwhichM_[4]; }; classZuluTimeImp: public TimeImp { public: ZuluTimeImp(inthr, int min, int zone): TimeImp(hr, min) { if (zone == 5) strcpy(zone_, " Eastern Standard Time");

else if (zone == 6) strcpy(zone_, " Central Standard Time"); } /* virtual */ void tell() { cout<< "time is " <<setw(2) <<setfill(48) <<hr_ << min_ << zone_ << endl; } protected: char zone_[30]; }; class Time { public: Time(){} Time(inthr, int min) { imp_ = new TimeImp(hr, min); } virtual void tell() { imp_->tell(); } protected: TimeImp *imp_; }; classCivilianTime: public Time { public: CivilianTime(inthr, int min, int pm) { imp_ = new CivilianTimeImp(hr, min, pm); } }; classZuluTime: public Time { public: ZuluTime(inthr, int min, int zone) { imp_ = new ZuluTimeImp(hr, min, zone); } }; int main() { Time *times[3]; times[0] = new Time(14, 30); times[1] = new CivilianTime(2, 30, 1); times[2] = new ZuluTime(14, 30, 6); for (int i = 0; i < 3; i++) times[i]->tell(); }

- Aaj Himur Biye - Humayun Ahmed
- BiConnected Component - Algorithm
- Articulation Point - Algorithm
- Articulation Point using DFS - Algorithm
- Algorithm Graphs with solution
- Normalization Forms - Intro to Db
- Entity Relationship Model - Intro to DB
- Relational Algebra - Intro to DB
- Macro Production Growth
- Elasticity - Micro Economics
- Production Cost - Micro Economics
- Demand Supply - Micro Economics
- Perfectly Competitive Market - Micro Economics
- Reccurence - Algorithm
- Graph Algorithm
- Dynamic Programming - Algorithm
- Shortest Path - Algorithm
- Greedy Algorithm
- Graph Introduction
- Ai Megh Rodro Chaya - Humayun Ahmed
- Compare and Contrast Writing
- Business Communication Course Outline

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...

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

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

- datastructure-100211095005-phpapp02
- Cycle Detection in Directed Graph
- Finalsol Sample[1]
- Trees in DataStructures
- Ban Dung Ryan 3
- L10_prolog2
- A 011320106
- BTrees
- 2. Ijamss - Maths - Wiener Index of Degree Spiltting - Sumathi
- Tree
- On Embedding and NP-Complete Problems of Equitable Labelings
- 15. Applied-signed Product Cordial Labeling and- Santhi.m
- [Sara] Robust Correspondence Recognition for Computer Vision
- PowerLaws(1)
- Network Coding and Fundamentals
- Linear
- On Smarandachely Harmonic Graphs
- Algortithm & Graph Theory
- Discovery and Analysis of Usage Patterns for Web Personalization
- FacetNet
- P. Komjath and S. Shelah- Universal graphs without large cliques
- Craciun Pantea Sontag Chapter
- Problem Search
- Probability Practice
- 1 - 1 - 1A Why Social Network Analysis- (13-54)
- sli06
- heap sort
- Interference v1
- 10.1.1.34
- er

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd