snippets/graph/Connectivity/isStronglyConnected.cpp
Graph Graph::getTranspose()
{
    Graph g(V);
    for (int v = 0; v < V; v++)
    {
        // Recur for all the vertices adjacent to this vertex
        list<int>::iterator i;
        for(i = adj[v].begin(); i != adj[v].end(); ++i)
        {
            g.adj[*i].push_back(v);
        }
    }
    return g;
}
// Function that returns reverse (or transpose) of this graph
Function that returns reverse (or transpose) of this graph
Function that returns reverse ( or transpose ) of this graph
Graph Graph::getTranspose()
{
    Graph g(V);
    for (int v = 0; v < V; v++)
    {
        list<int>::iterator i;
        for(i = adj[v].begin(); i != adj[v].end(); ++i)
        {
            g.adj[*i].push_back(v);
        }
    }
    return g;
}
Graph Graph :: getTranspose ( ) { Graph g ( V ) ; for ( int v = 0 ; v < V ; v ++ ) { list < int > :: iterator i ; for ( i = adj [ v ] . begin ( ) ; i != adj [ v ] . end ( ) ; ++ i ) { g . adj [ * i ] . push_back ( v ) ; } } return g ; }
Function that returns reverse (or transpose) of this graph
Function that returns reverse ( or transpose ) of this graph
// Recur for all the vertices adjacent to this vertex