Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

never ending max flow algorithm #28

@etiennedeg

Description

@etiennedeg

Hi,

The default max-flow algorithm is stuck in an endless loop with this graph:

The capacities of the first layer are all 0.1
The capacities of the second layer are all 1
The capacities of the third layer are all 0

Here is how to reproduce it :

using LightGraphsFlows
import LightGraphs
const lg = LightGraphs

flow_graph = lg.DiGraph(8)
capacity_matrix = zeros(8,8)
flow_edges = [
(1,3,0.1),(1,4,0.1),(1,5,0.1),(3,6,1),(3,7,1),(3,8,1),
(4,6,1),(4,7,1),(4,8,1),
(5,6,1),(5,7,1),(5,8,1),(6,2,0),(7,2,0),
(8,2,0)
]
for e in flow_edges
    u, v, f = e
    lg.add_edge!(flow_graph, u, v)
    capacity_matrix[u,v] = f
end
println(collect(lg.edges(flow_graph))) 
flow,flow_matrix = maximum_flow(flow_graph, 1, 2, capacity_matrix)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions