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

Inconsistent id types #338

Closed
nrkramer opened this issue Sep 4, 2023 · 3 comments · Fixed by #342
Closed

Inconsistent id types #338

nrkramer opened this issue Sep 4, 2023 · 3 comments · Fixed by #342
Assignees
Labels
core something about core enhancement New feature or request good first issue Good for newcomers Priority:High Priority Label for high priority issue

Comments

@nrkramer
Copy link
Collaborator

nrkramer commented Sep 4, 2023

There are sections of code where we use unsigned long for ids, some where we use std::size_t, and some we use unsigned long long. For example:

Node.hpp

std::size_t id = 0;

Here we're declaring std::size_t id = 0

Edge.hpp

unsigned long long id = 0;

Here we're declaring unsigned long long id = 0;

DirectedEdge.hpp

DirectedEdge(const unsigned long id, const Node<T> &node1,

Here we declare a constructor using const unsigned long id

Discussion

We should probably land on a concrete type that's declared in namespace CXXGraph and used universally throughout the library for id types.

Generally, I think 64 bits is more than enough for most use-cases, with a good tradeoff with performance/reduced hash collision when comparing ids. Lower bit values could squeeze out more performance - but it's highly use-case dependent.

Perhaps wherever we declare the id type, we should give the user the chance to redefine the type so that smaller or larger bit values can be used across the library. Perhaps with a documented macro.

What are your thoughts @sbaldu @ZigRazor ?

@nrkramer nrkramer changed the title Inconsistent id types. Inconsistent id types Sep 4, 2023
@nrkramer nrkramer added the core something about core label Sep 4, 2023
@ZigRazor
Copy link
Owner

ZigRazor commented Sep 4, 2023

I Agree with you solution!

@ZigRazor ZigRazor added enhancement New feature or request good first issue Good for newcomers Priority:High Priority Label for high priority issue labels Sep 4, 2023
@sbaldu
Copy link
Collaborator

sbaldu commented Sep 4, 2023

I agree as well

@nrkramer nrkramer self-assigned this Sep 4, 2023
@nrkramer
Copy link
Collaborator Author

nrkramer commented Sep 4, 2023

Alright, I'll take this one then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core something about core enhancement New feature or request good first issue Good for newcomers Priority:High Priority Label for high priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants