Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the implementation of the Edmond Karp algorithm along with test cases #252

Merged
merged 12 commits into from
Oct 16, 2024

Conversation

mapcrafter2048
Copy link
Contributor

Added the implementation of the Edmond Karp algorithm along with test cases

graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
@@ -0,0 +1,27 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please get rid of these unrelated changes in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this isn't resolved. The changes are still there.

Copy link
Contributor

@appgurueu appgurueu Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still there. Maybe you forgot to push a commit that gets rid of these additions (bisection_method.ts, decimal_convert.ts, euler_method.ts)?

@mapcrafter2048
Copy link
Contributor Author

I am extremely sorry for all the mistakes I have done and submitted the code for a review with twice checking it my self

Co-authored-by: Lars Müller <[email protected]>
@mapcrafter2048
Copy link
Contributor Author

I have tried implementing the changes suggest by @appgurueu
-removed the weight as it was not used here
-corrected the documentation for the space complexity form O(V) -> O9=(V^2)
-Implemented BFS using two level arrays (currentLevel and nextLevel) to maintain level-order traversal, avoiding the inefficient queue.shift() operation.
-Used an adjacency list representation for the residual graph to make the iteration over outgoing edges
-Changed the parent array initialization to null

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.89%. Comparing base (a08a122) to head (ab770c3).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #252      +/-   ##
==========================================
+ Coverage   96.82%   96.89%   +0.06%     
==========================================
  Files          98      100       +2     
  Lines        1829     1867      +38     
  Branches      345      354       +9     
==========================================
+ Hits         1771     1809      +38     
  Misses         58       58              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
graph/edmondkarp.ts Outdated Show resolved Hide resolved
Copy link
Contributor Author

@mapcrafter2048 mapcrafter2048 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement the changes suggest by you

graph/edmonds_karp.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be asymptotically fine now. Looks correct.

@raklaptudirm raklaptudirm merged commit 19b4ced into TheAlgorithms:master Oct 16, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants