Exemple #1
0
void p2(){
    struct flowNetwork * fN =createGraph();
    int i;
    breadthFirstPathSearch(fN, 0, 8);
    printf("Parent Array after Path Search: \n");
    for (i=0; i<NODES; i++) {
        printf("%d ", fN->parent[i]);
    }
    printf("\n");
    deleteFlowNetwork(fN);
}
void maximizeFlowNetwork(struct flowNetwork * fN, int s, int t){
    while (breadthFirstPathSearch(fN, s, t) == 1){
	int i = NODES-1, row, column;
	while (i != 0){
	    row = fN->parent[i];
	    column = i;
	    fN->adjMatrix[row][column].flow ++;
	    i = row;
	}
    }
}