From 523147f5df05b91728743f275eac481ed5f6c1bc Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 28 Oct 2022 18:01:57 +0200 Subject: [PATCH] Remove empty edges. --- src/graph/flow.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/graph/flow.rs b/src/graph/flow.rs index 78c20ed..572eea8 100644 --- a/src/graph/flow.rs +++ b/src/graph/flow.rs @@ -46,6 +46,11 @@ pub fn compute_flow( } } + used_edges.retain(|_, out| { + out.retain(|_, c| *c != U256::from(0)); + !out.is_empty() + }); + println!("Max flow: {flow}"); if flow > requested_flow {