apache / incubator-hugegraph-computer

HugeGraph Computer - A distributed graph processing system for hugegraph (OLAP)
https://hugegraph.apache.org/docs/quickstart/hugegraph-computer/
Apache License 2.0
42 stars 41 forks source link

feat(algorithm): support biased second order random walk #280

Closed diaohancai closed 9 months ago

diaohancai commented 10 months ago

Purpose of the PR

Main Changes

The current random walk algorithm requires 2 additional features.

  1. Biased random walk.
  2. Second order random walk.

Add the following parameters:

    private String weightProperty;
    private Double defaultWeight;
    private Double minWeightThreshold;
    private Double maxWeightThreshold;

    private Double returnFactor;
    private Double inOutFactor;
  1. String weightProperty. To implement biased random walk. The higher the weight, the higher the probability of walking.
  2. Double defaultWeight. Provide a default value if the weight is null.
  3. Double minWeightThreshold. Truncate when weight is less than the threshold to avoid too small weight.
  4. Double maxWeightThreshold. Truncate when weight exceeds the threshold to avoid overweighting.
  5. Double returnFactor. Controls the probability of re-walk to a previously walked vertex.
  6. Double inOutFactor. Controls whether to walk inward or outward.

For more details about returnFactor and inOutFactor, please refer to the paper《node2vec: scalable feature learning for networks》.

Verifying these changes

Does this PR potentially affect the following parts?

Documentation Status

codecov[bot] commented 10 months ago

Codecov Report

Attention: 29 lines in your changes are missing coverage. Please review.

Comparison is base (ff85e34) 85.03% compared to head (7d6e8ca) 84.99%. Report is 4 commits behind head on master.

:exclamation: Current head 7d6e8ca differs from pull request most recent head 94bd35b. Consider uploading reports for the commit 94bd35b to get more accurate results

Files Patch % Lines
...egraph/computer/algorithm/sampling/RandomWalk.java 78.86% 11 Missing and 15 partials :warning:
...hugegraph/computer/core/graph/value/ListValue.java 33.33% 1 Missing and 1 partial :warning:
...computer/algorithm/sampling/RandomWalkMessage.java 95.65% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #280 +/- ## ============================================ - Coverage 85.03% 84.99% -0.04% - Complexity 3246 3291 +45 ============================================ Files 345 349 +4 Lines 12298 12472 +174 Branches 1102 1129 +27 ============================================ + Hits 10458 10601 +143 - Misses 1315 1328 +13 - Partials 525 543 +18 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

diaohancai commented 9 months ago

some tiny comments

Thank you for your guidance.

diaohancai commented 9 months ago

THX~

Thank you for your guidance.