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 weight integer #14

Closed
Roconda opened this issue Feb 17, 2018 · 4 comments
Closed

Edge weight integer #14

Roconda opened this issue Feb 17, 2018 · 4 comments

Comments

@Roconda
Copy link

Roconda commented Feb 17, 2018

Hi,

I want to do path finding between multiple vertexes. I'm adding edges but my current weight values are decimal. The library returns the following message:

(ArgumentError) invalid value for :weight, must be an integer

I understand that integers are faster and don't have rounding errors. What is the reason that weights must be an integer?

ps: thanks for the lib :-)

@nl3v
Copy link

nl3v commented Apr 21, 2018

I'm not sure why this is, but you could use an integer representation of your decimal to get around it. If your decimal weight is 1.05 you could use 105 as the weight, or 1050 if you want another decimal place of precision, etc.

@georgewhewell
Copy link
Contributor

I made the following modifications and it seems to work: georgewhewell@548f314

ymmv

@Roconda
Copy link
Author

Roconda commented May 15, 2018

Thanks a lot @georgewhewell 😄

Might be worth creating a pull request.

@bitwalker
Copy link
Owner

Addressed in #19

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

No branches or pull requests

4 participants