Skip to content

Commit

Permalink
Fix the code example (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
NataliaIvakina committed Nov 5, 2024
1 parent 8f51a89 commit b281ae3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,20 +357,20 @@ class MaxWeightPathExpander implements PathExpander<Double>
}
@Override
public Iterable<Relationship> expand( Path path, BranchState<Double> branchState )
public ResourceIterable<Relationship> expand( Path path, BranchState<Double> branchState )
{
if (path.lastRelationship() != null) {
branchState.setState( branchState.getState() + (double) path.lastRelationship().getProperty( "weight" ) );
}
Iterable<Relationship> relationships = path.endNode().getRelationships( Direction.OUTGOING );
ResourceIterable<Relationship> relationships = path.endNode().getRelationships( Direction.OUTGOING );
ArrayList<Relationship> filtered = new ArrayList<>();
for ( Relationship relationship : relationships ) {
if ( branchState.getState() + (double) relationship.getProperty( "weight" ) <= maxWeight ) {
filtered.add(relationship);
}
}
return filtered;
return Iterables.asResourceIterable(filtered);
}
@Override
Expand Down

0 comments on commit b281ae3

Please sign in to comment.