verifier/Verifier.cpp
// The function to do DFS traversal. It uses BCCUtil()
The function to do DFS traversal.
The function to do DFS traversal .
void BCCGraph::BCC(vector<vector<pair<int, int> > >& res)
{
	result.push_back(vector<pair<int, int> >());
    int *disc = new int[V];
    int *low = new int[V];
    int *parent = new int[V];
    list<Edge> *st = new list<Edge>[E];
    for (int i = 0; i < V; i++)
    {
        disc[i] = -1;
        low[i] = -1;
        parent[i] = -1;
    }
    for (int i = 0; i < V; i++)
    {
        if (disc[i] == -1)
            BCCUtil(i, disc, low, st, parent);
        int j = 0;
        while(st->size() > 0) {
            j = 1;
			result.back().push_back(pair<int, int>(st->back().u, st->back().v));
            st->pop_back();
        }
        if(j == 1)
			result.push_back(vector<pair<int, int> >());
    }
	if (result.back().empty())
		result.pop_back();
	res = result;
}
void BCCGraph :: BCC ( vector < vector < pair < int , int > > > & res ) { result . push_back ( vector < pair < int , int > > ( ) ) ; int * disc = new int [ V ] ; int * low = new int [ V ] ; int * parent = new int [ V ] ; list < Edge > * st = new list < Edge > [ E ] ; for ( int i = 0 ; i < V ; i ++ ) { disc [ i ] = -1 ; low [ i ] = -1 ; parent [ i ] = -1 ; } for ( int i = 0 ; i < V ; i ++ ) { if ( disc [ i ] == -1 ) BCCUtil ( i , disc , low , st , parent ) ; int j = 0 ; while ( st -> size ( ) > 0 ) { j = 1 ; result . back ( ) . push_back ( pair < int , int > ( st -> back ( ) . u , st -> back ( ) . v ) ) ; st -> pop_back ( ) ; } if ( j == 1 ) result . push_back ( vector < pair < int , int > > ( ) ) ; } if ( result . back ( ) . empty ( ) ) result . pop_back ( ) ; res = result ; }
The function to do DFS traversal.
The function to do DFS traversal .
// Initialize disc and low, and parent arrays //If stack is not empty, pop all edges from stack