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

Bellman-Ford algorithm #69

Merged
merged 6 commits into from
Oct 11, 2021
Merged

Bellman-Ford algorithm #69

merged 6 commits into from
Oct 11, 2021

Conversation

sidml
Copy link
Contributor

@sidml sidml commented Oct 11, 2021

An implementation of Bellman-Ford algorithm as previously discussed here. I have also added a few test cases for checking the logic.
@ZigRazor Please take a look.
I wanted to add a test case with DirectedEdge (i.e. no weights) but that test case seems to be failing. I thought checking if edge->isWeighted() is true or not would be sufficient, but that doesn't seem to be the case. Perhaps I am missing something..

@ghost
Copy link

ghost commented Oct 11, 2021

Changes to your CodeSee Architecture Map:

View a CodeSee Map of these changes

View this PR diagram as an interactive map

View more CodeSee Maps

Legend

CodeSee Map Legend

@ZigRazor
Copy link
Owner

I wanted to add a test case with DirectedEdge (i.e. no weights) but that test case seems to be failing. I thought checking if edge->isWeighted() is true or not would be sufficient, but that doesn't seem to be the case. Perhaps I am missing something..

The return of isWeighted or isDirected function is a std::optional<bool> so to check if weighted or directed the correct if is this:

e->isWeighted().has_value() && e->isWeighted().value() for weighted
and
e->isDirected().has_value() && e->isDirected().value() for directed

where e is a pointer to the edge class.

So @sidml if you want to add the test, I wait to merge this pull request.
Let me know! 👍🏼

@ZigRazor ZigRazor self-assigned this Oct 11, 2021
@ZigRazor ZigRazor self-requested a review October 11, 2021 07:07
@ZigRazor ZigRazor added core something about core development Development of new Functionalities enhancement New feature or request hacktoberfest hacktoberfest issue labels Oct 11, 2021
@ZigRazor ZigRazor added this to the Algorithm Implementation milestone Oct 11, 2021
@ZigRazor ZigRazor linked an issue Oct 11, 2021 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2021

Codecov Report

Merging #69 (c795f4d) into master (28212ec) will increase coverage by 0.03%.
The diff coverage is 95.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
+ Coverage   94.48%   94.51%   +0.03%     
==========================================
  Files          32       33       +1     
  Lines        2937     3081     +144     
==========================================
+ Hits         2775     2912     +137     
- Misses        162      169       +7     
Flag Coverage Δ
unittests 94.51% <95.13%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/Graph/Graph.hpp 93.78% <87.93%> (-0.60%) ⬇️
test/BellmanFordTest.cpp 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28212ec...c795f4d. Read the comment docs.

@sidml sidml marked this pull request as ready for review October 11, 2021 07:41
@ZigRazor ZigRazor merged commit 0b778cd into ZigRazor:master Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core something about core development Development of new Functionalities enhancement New feature or request hacktoberfest hacktoberfest issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bellman–Ford Algorithm
3 participants