-
Notifications
You must be signed in to change notification settings - Fork 521
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 personalrank and neighborrank RESTful API #274
Conversation
b376b2f
to
3ec773d
Compare
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
} | ||
// The rank of each seed vertex is attenuated to original * (1 - alpha) | ||
for (Object vertexId : seedVertices) { | ||
double oldRank = rank.get(vertexId) * (1 - alpha); |
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.
will incorrect if have loop
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
consumer.accept(tmpSeeds); | ||
|
||
double sourceRank = tmpRank.get(sourceV); | ||
sourceRank += (1 - alpha); |
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.
why?
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.
https://blog.csdn.net/bbbeoy/article/details/78646635
source vertex need add (1 - alpha) every time
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
3ec773d
to
c84cab6
Compare
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeTraverser.java
Outdated
Show resolved
Hide resolved
while (++depth <= this.maxDepth) { | ||
Map<Id, Double> rankIncrs = this.getRankIncrs(seeds, labelDirs, | ||
labelId, ranks); | ||
this.combineIncrement(seeds, ranks, rankIncrs); |
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.
ranks = this.combineIncrement()
Map<Id, Double> ranks) { | ||
Map<Id, Double> rankIncrs = new HashMap<>(); | ||
for (Id seed : seeds) { | ||
Vertex vertex = this.graph().vertices(seed).next(); |
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.
will reduce the performance
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
c84cab6
to
eece519
Compare
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #274 +/- ##
===========================================
- Coverage 68.94% 68.9% -0.04%
Complexity 3278 3278
===========================================
Files 208 208
Lines 16171 16170 -1
Branches 2327 2327
===========================================
- Hits 11149 11142 -7
- Misses 3777 3783 +6
Partials 1245 1245
Continue to review full report at Codecov.
|
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example2.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankAlgorithm.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java
Outdated
Show resolved
Hide resolved
d9998a5
to
5936537
Compare
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-example/src/main/java/com/baidu/hugegraph/example/ValueComparableMap.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
} else if (o1 < o2) { | ||
return 1; | ||
} else { | ||
return 0; |
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.
will it delete duplicated values?
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.
No
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/util/OrderLimitMap.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/OrderLimitMapTest.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/OrderLimitMapTest.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/OrderLimitMapTest.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
Change-Id: I66e4224b5813aa2d5eadbfe540fb9de203db766b
Change-Id: I8cb701940a323883796c6cbc60dd8b17d4f6ba88
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/RankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
Change-Id: I8f02506cbc3acfa62072f46e4f2000e5edd8502c
Change-Id: Ib66fce20642e89b49a7bf45edb223ab4bd5c27dd
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PersonalRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PersonalRankTraverser.java
Show resolved
Hide resolved
Change-Id: I79b2d6ae1f780728cc935c147ca8d96f3a786bf8
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
Change-Id: I5012e7e7be649ccf7c7de160354a39b980fecf48
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-example/src/main/java/com/baidu/hugegraph/example/Example3.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/unit/UnitTestSuite.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
Change-Id: I8c27b23216bd9ee97c2afa613890a6a23b66df5d
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
Change-Id: I2bd0d75f0a798015ea302679cdf2635b7fc80745
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Show resolved
Hide resolved
Change-Id: I4ae50946c46a016872848dbcd9f69e70b6f290a2
Change-Id: I9829eacea9e8598a4475b39bd9699ea951de6a97
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PersonalRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PersonalRankTraverser.java
Outdated
Show resolved
Hide resolved
23add91
to
44e2712
Compare
Change-Id: Ib8c2da1f85c9e78504d704b0b3629a24b0666e42
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.
remove @Status(Status.CREATED) for CustomizedPathsAPI and CustomizedCrosspointsAPI
Change-Id: Iccda41b7869a53a77177d342754f080f6e4612e4
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java
Outdated
Show resolved
Hide resolved
Change-Id: I9cb451b4612ff540da9e1045a44970e119d35d6e
Change-Id: Ifc65c488aac51111551e78bf3deb5790c5e83491