Does the Ford-Fulkerson Algorithm work on dense, cyclic graphs?

Started by
3 comments, last by Nypyren 6 years ago

I've got a grid alike structure, in which there are on maximum 4 portals (exits) around each cluster... I found that sometimes the algorithm never terminates such as on this structure where
I want to travel from cluster 3 to 9


Big Box:=====>
id: 0min x: -40.5623 y:-0.0923912 z:-40.0071 max x: -23.2048 y:-0.0923912 z:-24.0042 12 neis size:2
Big Box:=====>
id: 1min x: -40.5623 y:-0.0923912 z:-24.0042 max x: -23.2048 y:-0.0923912 z:-8.00142 0 neis size:4
Big Box:=====>
id: 2min x: -40.5623 y:-0.0923912 z:-8.00142 max x: -23.2048 y:-0.0923912 z:8.00141 3 neis size:4
Big Box:=====>
id: 3min x: -40.5623 y:-0.0923912 z:8.00141 max x: -23.2048 y:-0.0923912 z:24.0042 4 neis size:4
Big Box:=====>
id: 4min x: -40.5623 y:-0.0923912 z:24.0042 max x: -23.2048 y:-0.0923912 z:40.0071 4 neis size:3
Big Box:=====>
id: 5min x: -23.2048 y:-0.0923912 z:-40.0071 max x: -5.84741 y:-0.0923912 z:-24.0042 17 neis size:2
Big Box:=====>
id: 6min x: -23.2048 y:-0.0923912 z:-24.0042 max x: -5.84741 y:-0.0923912 z:-8.00142 0 neis size:4
Big Box:=====>
id: 7min x: -23.2048 y:-0.0923912 z:-8.00142 max x: -5.84741 y:-0.0923912 z:8.00141 1 neis size:4
Big Box:=====>
id: 8min x: -23.2048 y:-0.0923912 z:8.00141 max x: -5.84741 y:-0.0923912 z:24.0042 0 neis size:4
Big Box:=====>
id: 9min x: -23.2048 y:-0.0923912 z:24.0042 max x: -5.84741 y:-0.0923912 z:40.0071 3 neis size:3
Big Box:=====>
id: 10min x: -5.84741 y:-0.0923912 z:-40.0071 max x: 11.51 y:-0.0923912 z:-24.0042 12 neis size:2
Big Box:=====>
id: 11min x: -5.84741 y:-0.0923912 z:-24.0042 max x: 11.51 y:-0.0923912 z:-8.00142 0 neis size:4
Big Box:=====>
id: 12min x: -5.84741 y:-0.0923912 z:-8.00142 max x: 11.51 y:-0.0923912 z:8.00141 0 neis size:4
Big Box:=====>
id: 13min x: -5.84741 y:-0.0923912 z:8.00141 max x: 11.51 y:-0.0923912 z:24.0042 0 neis size:4
Big Box:=====>
id: 14min x: -5.84741 y:-0.0923912 z:24.0042 max x: 11.51 y:-0.0923912 z:40.0071 5 neis size:3
Big Box:=====>
id: 15min x: 11.51 y:-0.0923912 z:-40.0071 max x: 28.8675 y:-0.0923912 z:-24.0042 12 neis size:2
Big Box:=====>
id: 16min x: 11.51 y:-0.0923912 z:-24.0042 max x: 28.8675 y:-0.0923912 z:-8.00142 0 neis size:4
Big Box:=====>
id: 17min x: 11.51 y:-0.0923912 z:-8.00142 max x: 28.8675 y:-0.0923912 z:8.00141 3 neis size:4
Big Box:=====>
id: 18min x: 11.51 y:-0.0923912 z:8.00141 max x: 28.8675 y:-0.0923912 z:24.0042 31 neis size:4
Big Box:=====>
id: 19min x: 11.51 y:-0.0923912 z:24.0042 max x: 28.8675 y:-0.0923912 z:40.0071 4 neis size:3
Big Box:=====>
id: 20min x: 28.8675 y:-0.0923912 z:-40.0071 max x: 46.2249 y:-0.0923912 z:-24.0042 1 neis size:1
Big Box:=====>
id: 21min x: 28.8675 y:-0.0923912 z:-24.0042 max x: 46.2249 y:-0.0923912 z:-8.00142 3 neis size:3
Big Box:=====>
id: 22min x: 28.8675 y:-0.0923912 z:-8.00142 max x: 46.2249 y:-0.0923912 z:8.00141 8 neis size:3
Big Box:=====>
id: 23min x: 28.8675 y:-0.0923912 z:8.00141 max x: 46.2249 y:-0.0923912 z:24.0042 0 neis size:3
Big Box:=====>
id: 24min x: 28.8675 y:-0.0923912 z:24.0042 max x: 46.2249 y:-0.0923912 z:40.0071 5 neis size:2



If the cluster is in the middle, obviously we will have 4 exits, on the side, we got 3, in the corner, we have 2
Advertisement

I haven't implemented one of these myself yet, but I see cycles shown in the examples on the https://en.wikipedia.org/wiki/Edmonds–Karp_algorithm page (a specific implementation of the method you mentioned).

I'm not quite sure how to interpret your printout as a graph, though.

Okay, I sub it that algorithm for the max-flow part, the result is 10, did it look pretty right? each edge costs 5
thanks
Jack

I'm not very familiar with maximum flow.  What I would do to verify an algorithm is come up with a few test cases that you know how to compute by hand, and then make sure your code produces the same results.  You could use unit testing for that.

This topic is closed to new replies.

Advertisement