copy-pasta/maxFlow.cpp
//to mark nodes reachable from source

to mark nodes reachable from source
to mark nodes reachable from source
void bfs(Node* source)
{
    auto visited = vector<bool>(numNodes, false);
    vector<Node*> Q;
    int front = 0;
    Q.push_back(source);
    visited[source->id] = true;
    source->inCut = true;
    while(front!=Q.size())
    {
        Node* current = Q[front++];
        for(Edge* edge : current->outgoingEdges)
        {
            if(!visited[edge->to->id] && !(edge->capacity == edge->flow))
            {
                Q.push_back(edge->to);
                visited[edge->to->id] = true;
                edge->to->inCut = true;
            }
        }
    }
}
void bfs ( Node * source ) { auto visited = vector < bool > ( numNodes , false ) ; vector < Node * > Q ; int front = 0 ; Q . push_back ( source ) ; visited [ source -> id ] = true ; source -> inCut = true ; while ( front != Q . size ( ) ) { Node * current = Q [ front ++ ] ; for ( Edge * edge : current -> outgoingEdges ) { if ( ! visited [ edge -> to -> id ] && ! ( edge -> capacity == edge -> flow ) ) { Q . push_back ( edge -> to ) ; visited [ edge -> to -> id ] = true ; edge -> to -> inCut = true ; } } } }
to mark nodes reachable from source
to mark nodes reachable from source
//bfs from source
 //Q.pop();
 //already seen this node
