Fix bug Random Walk in array sizes #2089
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Random walk implementation returns a list of paths (vertex ids) and a list of edge weights for the edges on those paths.
@betochimas discovered that the size of the returned arrays is the same, even though the contents are different sizes. In his example, if the return path contains one path:
[ 0, 1, 3, 5 ]
it returns a weights array with 4 elements[0.1, 2.1, 7.2, ???]
even though only the first three elements are valid. The weights are edge weights, the path[0,1,3,5]
only has 3 edges. The first 3 elements in the returned array are correct. Interpreting the results as intended will never reference that value. However the sizes should be correct.This PR fixes the initialization of the arrays to the correct size, which seems to correct the bug.