snippets/graph/Connectivity/biconnected.cpp
bool Graph::isBC()
{
    // Mark all the vertices as not visited
    bool *visited = new bool[V];
    int *disc = new int[V];
    int *low = new int[V];
    int *parent = new int[V];

    // Initialize parent and visited, and ap(articulation point)
    //  arrays
    for (int i = 0; i < V; i++)
    {
        parent[i] = NIL;
        visited[i] = false;
    }

    // Call the recursive helper function to find if there is an articulation
    // point in given graph. We do DFS traversal starring from vertex 0
    if (isBCUtil(0, visited, disc, low, parent) == true)
        return false;

    // Now check whether the given graph is connected or not. An undirected
    // graph is connected if all vertices are reachable from any starting
    // point (we have taken 0 as starting point)
    for (int i = 0; i < V; i++)
        if (visited[i] == false)
            return false;

    return true;
}
// The main function that returns true if graph is Biconnected,
// otherwise false. It uses recursive function isBCUtil()
The main function that returns true if graph is Biconnected,
otherwise false. It uses recursive function isBCUtil()
The main function that returns true if graph is Biconnected otherwise false . It uses recursive function isBCUtil ()
bool Graph::isBC()
{
    bool *visited = new bool[V];
    int *disc = new int[V];
    int *low = new int[V];
    int *parent = new int[V];
    for (int i = 0; i < V; i++)
    {
        parent[i] = NIL;
        visited[i] = false;
    }
    if (isBCUtil(0, visited, disc, low, parent) == true)
        return false;
    for (int i = 0; i < V; i++)
        if (visited[i] == false)
            return false;
    return true;
}
bool Graph :: isBC ( ) { bool * visited = new bool [ V ] ; int * disc = new int [ V ] ; int * low = new int [ V ] ; int * parent = new int [ V ] ; for ( int i = 0 ; i < V ; i ++ ) { parent [ i ] = NIL ; visited [ i ] = false ; } if ( isBCUtil ( 0 , visited , disc , low , parent ) == true ) return false ; for ( int i = 0 ; i < V ; i ++ ) if ( visited [ i ] == false ) return false ; return true ; }
The main function that returns true if graph is Biconnected,
otherwise false.
The main function that returns true if graph is Biconnected otherwise false .
// Mark all the vertices as not visited // Initialize parent and visited, and ap(articulation point) //  arrays // Call the recursive helper function to find if there is an articulation // point in given graph. We do DFS traversal starring from vertex 0 // Now check whether the given graph is connected or not. An undirected // graph is connected if all vertices are reachable from any starting // point (we have taken 0 as starting point)