https://github.com/simon-gardier/graph-flow
π Flow visualization in graphs using Ford Fulkerson algorithm
https://github.com/simon-gardier/graph-flow
data-science graph-algorithms math0499 networkx python
Last synced: over 1 year ago
JSON representation
π Flow visualization in graphs using Ford Fulkerson algorithm
- Host: GitHub
- URL: https://github.com/simon-gardier/graph-flow
- Owner: simon-gardier
- Created: 2024-03-09T22:38:47.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-05T16:29:45.000Z (about 2 years ago)
- Last Synced: 2025-01-27T11:17:19.711Z (over 1 year ago)
- Topics: data-science, graph-algorithms, math0499, networkx, python
- Language: Python
- Homepage: https://fr.wikipedia.org/wiki/Algorithme_de_Ford-Fulkerson
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Ford-Fulkerson algorithm


Python project developped for the graph theory course (MATH0499) given by Pr. Rigo, ULiège.
The final mark for this project is 19/20.
The Ford-Fulkerson algorithm is a graph algorithm used to determine the maximum flow from a source node to a sink node. It can also be used to calculate if a minimum flow can flow through an entire network.
Using the -g option (see [Examples](#examples)), you can visualize the flow in the graph.
The lighter the color of an edge, the more saturated it is.
## Summary
1. [Required Modules](#required-modules)
2. [Project structure](#project-structure)
3. [Examples](#examples)
4. [Technical Specifics](#technical-specifics)
5. [Credits](#credits)
## Required modules
- NetworkX [https://pypi.org/project/networkx/](https://pypi.org/project/networkx/)
- Matplotlib
- Pylab
## Project structure
- ./
- main.py: Main script
- ford_fulkerson.py: Script containing the Ford-Fulkerson algorithm and pre-processing functions for loading files into Graph() objects
- display.py: Script for displaying graphs via matplotlib
- utils.py: Script for creating random graphs of any size
## Examples
1. **Finding the maximum flow from s to t in an existing file**
```console
python3 main.py -i filename.txt -s s -t t
```
2. **Finding the maximum flow from s to t in an existing file and displaying the residual graph in a window**
```console
python3 main.py -i filename.txt -s s -t t -g
```
3. **Finding the maximum flow from multiple sources to t in an existing file**
```console
python3 main.py -i filename.txt -s "s_1 s_2 s_3 s_n" -t t
```
4. **Finding the maximum flow from multiple sources to multiple sinks in an existing file**
```console
python3 main.py -i filename.txt -s "s_1 s_2 s_3 ... s_n" -t "t_1 t_2 ... t_k"
```
5. **Finding the maximum flow from s to t in a randomly generated file with n vertices**
```console
python3 main.py -r n -s s -t t
```
## Technical specifics
- Randomly generated graphs are systematically stored in ./example_random_graph.txt
- Graphs are stored in Edge List files (see [NetworkX Edge List documentation](https://networkx.org/documentation/stable/reference/readwrite/edgelist.html))
## Credits
- [Simon Gardier](https://github.com/simon-gardier) (Co-author)
- Camille Trinh (Co-author)