You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 18, 2026. It is now read-only.
refactor: extract duplicate BFS in NetworkFlowAnalyzer, reduce redundant computation (#79)
The getMinCut() and getSourceSide() methods both contained identical
BFS traversals to find vertices reachable from source in the residual
graph. Extracted into a single findReachableFromSource() private method.
Also fixed getSummary() and getResult() which were calling
decomposeFlowPaths(), getMinCut(), and getBottleneckEdges()
independently — each triggering their own traversals. Now each method
computes these expensive results once and reuses them.
Changes:
- New private findReachableFromSource() method (single BFS)
- getMinCut() delegates to findReachableFromSource()
- getSourceSide() delegates to findReachableFromSource()
- getSummary() computes paths/minCut/bottlenecks once, reuses
- getResult() computes paths/minCut/bottlenecks once, reuses
No behavioral changes — all 52 existing tests remain valid.
0 commit comments