This repository contains a C implementation of the Ford-Fulkerson algorithm for finding the maximum flow in a network.
The Ford-Fulkerson algorithm is a method for finding the maximum flow in a network (directed graph) with capacities assigned to its edges. The algorithm iteratively finds augmenting paths from the source to the sink, updating the flow in the network until no more augmenting paths can be found.
-
Compilation:
- Compile the code using a C compiler (e.g., GCC).
gcc /code/index.c -o ford_fulkerson
- Compile the code using a C compiler (e.g., GCC).
-
Execution:
- Run the compiled executable, providing the input as necessary.
./ford_fulkerson
- Run the compiled executable, providing the input as necessary.
-
Input:
- The network and its capacities are defined in the
red
matrix in the code. - Modify the
fuente
(source) andsumidero
(sink) variables in themain
function as needed.
- The network and its capacities are defined in the
- The algorithm assumes non-negative capacities on edges. If negative capacities are present, the algorithm may not work correctly.
- The
red
matrix represents the adjacency matrix with edge capacities.
Feel free to contribute to enhance the algorithm or provide improvements. Open issues and submit pull requests to collaborate.
This code is licensed under the MIT License - see the LICENSE file for details.