-
Notifications
You must be signed in to change notification settings - Fork 117
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
Fix bug in Eulerian path algorithm #314
Conversation
template <typename T> | ||
const Node<T> *Edge<T>::getOtherNode(const Node<T> *node) const { | ||
if (this->getNodePair().first == node) { | ||
return this->getNodePair().second; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule
if (this->getNodePair().first == node) { | ||
return this->getNodePair().second; | ||
} else { | ||
return this->getNodePair().first; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule
// links | ||
auto firstNodeIt = | ||
std::max_element(nodeSet.begin(), nodeSet.end(), [adj](auto n1, auto n2) { | ||
return adj->at(n1).size() < adj->at(n2).size(); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule
// The starting node is the only node which has more outgoing than ingoing | ||
// links | ||
auto firstNodeIt = | ||
std::max_element(nodeSet.begin(), nodeSet.end(), [adj](auto n1, auto n2) { |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 806 with no text in the supplied rule-texts-file
Codecov Report
@@ Coverage Diff @@
## master #314 +/- ##
==========================================
+ Coverage 97.63% 97.71% +0.07%
==========================================
Files 53 53
Lines 7449 7487 +38
==========================================
+ Hits 7273 7316 +43
+ Misses 176 171 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Fix bug in the choice of the first node in the Eulerian path algorithm (issue #312).
Also changed the choice of the next node in an edge, so that the algorithm works correctly for undirected graphs as well.
Also added a test case for undirected graphs.