-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat(algorithm): support random walk in computer #274
Conversation
IdListList curValue = sourceVertex.value(); | ||
curValue.add(path.copy()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line
this.path.add(vertex.id()); | ||
} | ||
|
||
public Boolean getIsFinish() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer isFinish
return isFinish.value(); | ||
} | ||
|
||
public void setIsFinish(Boolean isFinish) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer boolean isFinish
public void setIsFinish(Boolean isFinish) { | ||
this.isFinish = new BooleanValue(isFinish); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
} | ||
return propValues; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
this.setIfAbsent(params, RandomWalk.OPTION_WALK_LENGTH, | ||
"3"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
return this.path; | ||
} | ||
|
||
public void addPath(Vertex vertex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer addToPath
|
||
@Override | ||
public String name() { | ||
return "randomWalk"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also keep "page_rank" style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok~ Thanks~
} | ||
|
||
public Boolean isFinish() { | ||
return isFinish.value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to call boolValue()
instead of value()
here and let isFinish() return boolean type.
and please also keep this.isFinish
style.
this.setIfAbsent(params, RandomWalk.OPTION_WALK_PER_NODE, | ||
"3"); | ||
this.setIfAbsent(params, RandomWalk.OPTION_WALK_LENGTH, | ||
"3"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep in one line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok~
note ci error: computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalk.java:111:
Line is longer than 100 characters (found 106). [LineLength] |
Codecov Report
@@ Coverage Diff @@
## master #274 +/- ##
============================================
- Coverage 85.82% 85.17% -0.66%
- Complexity 3233 3277 +44
============================================
Files 344 349 +5
Lines 12124 12388 +264
Branches 1092 1112 +20
============================================
+ Hits 10406 10552 +146
- Misses 1193 1305 +112
- Partials 525 531 +6
... and 13 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Purpose of the PR
Main Changes
Add an algorithm: random walk.
Verifying these changes
Please run unit test:
org.apache.hugegraph.computer.algorithm.sampling.RandomWalkTest#testRunAlgorithm
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO
Doc - Done
Doc - No Need