Biconnected Graph ADSA
Biconnected Graph ADSA
Biconnected Graph
Data Structure Algorithms Graph Algorithms
An undirected graph is said to be a biconnected graph, if there are two vertex-disjoint paths between
any two vertices are present. In other words, we can say that there is a cycle between any two vertices.
We can say that a graph G is a bi-connected graph if it is connected, and there are no articulation points
or cut vertex are present in the graph.
To solve this problem, we will use the DFS traversal. Using DFS, we will try to find if there is any
articulation point is present or not. We also check whether all vertices are visited by the DFS or not, if
not we can say that the graph is not connected.
Input:
The adjacency matrix of the graph.
01110
10100
11001
10001
00110
Output:
The Graph is a biconnected graph.
Algorithm
isArticulation(start, visited, disc, low, parent)
Page 2 of 5
Input: The start vertex, the visited array to mark when a node is visited, the disc will hold the discovery time of
the vertex, and low will hold information about subtrees. The parent will hold the parent of the current vertex.
Begin
time := 0 //the value of time will not be initialized for next function calls
dfsChild := 0
mark start as visited
set disc[start] := time+1 and low[start] := time + 1
time := time + 1
isBiconnected(graph)
Begin
initially set all vertices are unvisited and parent of each vertices are φ
if isArticulation(0, visited, disc, low, parent) = true, then
Page 3 of 5
return false
Explore our latest online courses and learn new skills at your own pace. Enroll and become a certified
expert to boost your career.
Example
#include<iostream>
#define NODE 5
using namespace std;
int graph[NODE][NODE] = {
{0, 1, 1, 1, 0},
{1, 0, 1, 0, 0},
{1, 1, 0, 0, 0},
{1, 0, 0, 0, 1},
{0, 0, 0, 1, 0}
};
bool isArticulation(int start, bool visited[], int disc[], int low[], int
static int time = 0;
int dfsChild = 0;
visited[start] = true; //make the first vertex is visited
disc[start] = low[start] = ++time; //initialize discovery time and th
bool isBiConnected() {
bool *vis = new bool[NODE];
int *disc = new int[NODE];
int *low = new int[NODE];
int *parent = new int[NODE];
int main() {
if(isBiConnected())
cout << "The Graph is a biconnected graph.";
else
cout << "The Graph is not a biconnected graph.";
}
Output