cpupar.cpp
// Subroutine for Dinic's algorithm, used to update the levels of nodes in the
// layered graph with BFS. Returns true if a path from s to t with positive
// capacity still exists.
Subroutine for Dinic's algorithm, used to update the levels of nodes in the
layered graph with BFS. Returns true if a path from s to t with positive
capacity still exists.
Subroutine for Dinic ' s algorithm used to update the levels of nodes in the layered graph with BFS . Returns true if a path from s to t with positive capacity still exists .
bool bfsTopDownDinicLayered(Graph *g, vertexSet *frontier, vertexSet *threadFrontiers,
                            int *flowMatrix, int *levels, int s, int t) {
    int maxThreads = omp_get_max_threads();
    bool foundT = false;
    vertexSetClear(frontier);
    #pragma omp parallel for schedule(static)
    for (int i=0; i < maxThreads; i++) {
        vertexSetClear(&threadFrontiers[i]);
    }
    #pragma omp parallel for schedule(static)
    for (int i=0; i < g->n; i++) {
        levels[i] = NOT_VISITED_MARKER;
    }
    frontier->vertices[frontier->count++] = s;
    levels[s] = 0;
    while (frontier->count != 0) {
        foundT = topDownStepDinic(g, frontier, threadFrontiers, flowMatrix, 
                                  levels, t);
        if (foundT) {
            break;
        }
    }
    return foundT;
}
bool bfsTopDownDinicLayered ( Graph * g , vertexSet * frontier , vertexSet * threadFrontiers , int * flowMatrix , int * levels , int s , int t ) { int maxThreads = omp_get_max_threads ( ) ; bool foundT = false ; vertexSetClear ( frontier ) ; #pragma  omp parallel for schedule(static) for ( int i = 0 ; i < maxThreads ; i ++ ) { vertexSetClear ( & threadFrontiers [ i ] ) ; } #pragma  omp parallel for schedule(static) for ( int i = 0 ; i < g -> n ; i ++ ) { levels [ i ] = NOT_VISITED_MARKER ; } frontier -> vertices [ frontier -> count ++ ] = s ; levels [ s ] = 0 ; while ( frontier -> count != 0 ) { foundT = topDownStepDinic ( g , frontier , threadFrontiers , flowMatrix , levels , t ) ; if ( foundT ) { break ; } } return foundT ; }
Subroutine for Dinic's algorithm, used to update the levels of nodes in the
layered graph with BFS.
Subroutine for Dinic ' s algorithm used to update the levels of nodes in the layered graph with BFS .