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

Edge equality operator is incorrect #333

Closed
nrkramer opened this issue Jul 28, 2023 · 2 comments
Closed

Edge equality operator is incorrect #333

nrkramer opened this issue Jul 28, 2023 · 2 comments
Assignees
Labels
bug Something isn't working core something about core Priority:Critical Priority Label for Critical Issue

Comments

@nrkramer
Copy link
Collaborator

nrkramer commented Jul 28, 2023

The current edge equality operator is this:

template <typename T>
bool operator==(shared<const Edge<T>> p1, shared<const Edge<T>> p2) {
  return p1->getNodePair().first->getUserId() ==
             p2->getNodePair().first->getUserId() &&
         p2->getNodePair().second->getUserId() ==       <<<< bad
             p2->getNodePair().second->getUserId();
}

This is incorrect, since the second user ids are not getting compared against each-other (we're comparing p2->getNodePair().second->getUserId() against itself).

This will be changed to:

template <typename T>
bool operator==(shared<const Edge<T>> p1, shared<const Edge<T>> p2) {
  return p1->getNodePair().first->getUserId() ==
             p2->getNodePair().first->getUserId() &&
         p1->getNodePair().second->getUserId() ==       <<<< good
             p2->getNodePair().second->getUserId();
}

To resolve this bug.

Edge equality is a core functionality of this library. Therefore I'm marking this as critical.

@nrkramer nrkramer self-assigned this Jul 28, 2023
@nrkramer nrkramer added bug Something isn't working core something about core Priority:Critical Priority Label for Critical Issue labels Jul 28, 2023
nrkramer added a commit to nrkramer/CXXGraph that referenced this issue Jul 28, 2023
@sbaldu
Copy link
Collaborator

sbaldu commented Jul 28, 2023

Yep, it's a typo, my bad. Thanks : )

@nrkramer
Copy link
Collaborator Author

Opened a PR here: #326

nrkramer added a commit to nrkramer/CXXGraph that referenced this issue Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core something about core Priority:Critical Priority Label for Critical Issue
Projects
None yet
Development

No branches or pull requests

2 participants