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

add integer support to balance algorithm; apply formatting #1898

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wyatt-joyner-pometry
Copy link
Contributor

@wyatt-joyner-pometry wyatt-joyner-pometry commented Dec 11, 2024

What changes were proposed in this pull request?

Add integer support to balance algorithm.

Why are the changes needed?

Fixes #1406. Previously, edge properties had to be converted to floats. Now ints and floats both work as expected.

Does this PR introduce any user-facing change? If yes is this documented?

No method signatures have been affected.

How was this patch tested?

I updated the Rust unit-test to test ints and it passes.

Are there any further changes required?

N/A

Copy link
Collaborator

@ljeub-pometry ljeub-pometry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely an improvement over what it was doing before so we can merge.

I wonder if it is worth writing this so it doesn't change the type of the output compared to the input property.

Also, maybe make this return a result instead of 0 balances if the property is not convertible to float?

@@ -58,7 +58,7 @@ fn balance_per_node<'graph, G: GraphViewOps<'graph>, GH: GraphViewOps<'graph>, C
prop.temporal().get(name).map(|val| {
val.values()
.into_iter()
.map(|valval| valval.into_f64().unwrap_or(0.0f64))
.map(|valval| valval.as_f64().unwrap_or(0.0f64))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this algorithm have a check for the type of the property instead of just returning all 0 if it happens to be a string or something else that can't be converted to float?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative is that edge weights default to 1. @miratepuffin @Alnaimi- any thoughts?

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

Successfully merging this pull request may close these issues.

Balance only seems to work for float properties
2 participants