2025-08-03: checkpoint

This commit is contained in:
2025-08-03 18:34:13 +02:00
parent 8d28ef44be
commit ba3cd9591e
16 changed files with 1219 additions and 354 deletions

94
README.md Normal file
View File

@@ -0,0 +1,94 @@
# Maxflow-rs
## Idea
- Generate StableGraph (petgraph)
- run algo on that
- Create a custom to_graph method which displays a maxflow graph
TODOs
- [ ] Implementation of Algos:
- [x] Ford-Fulkersson (DFS zur Berechnung des flusserhöhenden/augmentierenden Pfads)
- [x] Edmonds-Karp (BFS zur Berechnung des flusserhöhenden/augmnetierenden Pfads)
- [x] Dinic
- [ ] Goldberg-Tarjan/Preflow-Push
- [ ] Step-by-step implementation for all algos
- [x] Ford-Fulkerson
- [x] Edmonds-Karp
- [x] Dinic
- [ ] Goldberg-Tarjan/Preflow-Push
- [x] Mark edges which have active flows with a color
- [x] Move GUI Graph conversion to a trait of StableGraph
- [ ] Add graph positioning strategy which looks "nicer"#
- [x] Only insert nodes which are at least a distance of 40 away (default)
- [ ] Pseudo-random node positioning strategy
- [ ] Handle residual edges properly
- [x] Add display option for residual edges
- [x] Only show active flows (filter all edges with f=0)
- [ ] Show normal vs residual graph
- [x] When increasing flows, handle residual path
- [ ] Add unit tests
- [ ] With small problems to prove correctness
- [ ] For Benchmarking the algos
- [ ] Check validity of the generated flows (incoming flows = outgoing flows; flow <= capacity)
- [ ] Add info display pane
- [x] is valid flow? (add trait to graph)
- [x] current total flow (add trait to calculate)
- [ ] number of steps
- [ ] implement PartialEq for StableGraph (not really possible -> how do you compare graphs?)
- [ ] Step-by-step vizualisation with choosable time delay
- [ ] Dinic: add GUI options to show Layer Graph and Blocking flow
- [ ] Goldberg-Tarjan: show distance labels at nodes
- [x] change GUI colors to accomodate color-blindness (blue-yellow rather than red-green)
- [x] remove display option for residual graph -> this should be the default
DFS: Stack
BFS: Queue
Bugs:
- [x] if I generate a new graph, the algo runs on the old graph
- [x] if I click reset & then step, the algo runs in one step
- [x] when using edmonds karp the updated flow isn't displayed correctly
- [ ] the capacity on residual edges also gets displayed when using
Residual Graph:
- parallel arcs in the same direction can be summarized into a single arc by summing up the capcities
-
TODOs:
- [x] gui colors in yellow blue (should be easy)
- [x] no residual graph option, residual graph is default (medium, bit of effort)
- [ ] do we need to delete the graph field in algos & use residual_graph instead?
- [ ] check correctness of all algos by testing a small sample#
- [ ] gui display options (medium)
- [ ] layer graph (done - TODO: check if correct) & blocking flow (for Dinic)
- [ ] goldberg-tarjan: push-relabel step - current pre-flow, flow change in every step
- [x] add time delay for algorithm (hard due to multithreading)
- [ ] fix glitchy graph display (somewhere in update_graph function)
- [ ] implement goldberg tarjan (hard)
- [x] fix residual edges: algo pushes flows back but increases flow on the residual edge instead of decreasing the reverse edge
- [ ] fix loops: somehow the algo produces loops towards the source node (not critical for calculating the total flow, but should be fixed)
- [ ] big tests sometimes fail for goldberg-tarjan (panic when reading node from distance labelling)
- [x] make MaxflowAlgorithm object-safe (remove from_problem & implement it per struct, then create a generic wrapper which creates new instances for each specific algorithm)
- [ ] add unit test environment (hard)
- [x] callable from gui
- [x] several test tuples [number of problems, node count, max capacity]
- [x] split MaxflowProblem:new into two functions (one for display, one for test environment)
- [x] apply to every algo
- [x] große testumgebung
- [x] testfunktion in seperatem thread ausführen, damit programm nicht hängt
- [ ] check for:
- [x] flusserhaltung
- [x] kapazitätsbedingungen
- [ ] saturierter schritt
- [ ] testumgebung durch änderungen der lösung automatisch überprüfen (korrektheit, optimalität)
- [x] reduce warnings
thread '<unnamed>' panicked at src/graph.rs:191:31
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at src/algorithms/goldberg_tarjan.rs:109:238:
No distance label found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace