diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java index ffdfae072d..43eaaada71 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java @@ -75,7 +75,8 @@ public String post(@Context GraphManager manager, "The steps of request can't be null or empty"); E.checkArgumentNotNull(request.dedupSize == NO_LIMIT || request.dedupSize >= 0L, - "The dedupSize of request must >= 0, but got '%s'", + "The dedup size of request " + + "must >= 0 or == -1, but got: '%s'", request.dedupSize); HugeGraph g = graph(manager, graph); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java index ea206a93c3..8ed4006b2a 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java @@ -77,8 +77,8 @@ public String post(@Context GraphManager manager, "The min neighbor count must be > 0, but got: %s", request.minNeighbors); E.checkArgument(request.maxDegree > 0L || request.maxDegree == NO_LIMIT, - "The max_degree of request must be > 0, but got: %s", - request.maxDegree); + "The max degree of request must be > 0 or == -1, " + + "but got: %s", request.maxDegree); E.checkArgument(request.alpha > 0 && request.alpha <= 1.0, "The alpha of request must be in range (0, 1], " + "but got '%s'", request.alpha); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java index 98e1e54c36..563d08ca5a 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java @@ -69,11 +69,11 @@ public String personalRank(@Context GraphManager manager, "The alpha of rank request must be in range (0, 1], " + "but got '%s'", request.alpha); E.checkArgument(request.maxDegree > 0L || request.maxDegree == NO_LIMIT, - "The max_degree of rank request must be > 0, " + - "but got: %s", request.maxDegree); + "The max degree of rank request must be > 0 " + + "or == -1, but got: %s", request.maxDegree); E.checkArgument(request.limit > 0L || request.limit == NO_LIMIT, - "The limit of rank request must be > 0, but got: %s", - request.limit); + "The limit of rank request must be > 0 or == -1, " + + "but got: %s", request.limit); E.checkArgument(request.maxDepth > 0L && request.maxDepth <= Long.parseLong(DEFAULT_MAX_DEPTH), "The max depth of rank request must be " + diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java index cc37a34327..9b1159d709 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java @@ -82,7 +82,7 @@ protected void closeTx() { public void setMinSaveInterval(long seconds) { E.checkArgument(seconds > 0, - "Must set interval > 0, bug got '%s'", seconds); + "Must set interval > 0, but got '%s'", seconds); this.saveInterval = seconds * 1000L; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java index ec1fb3ad1b..0c85111d6c 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java @@ -141,16 +141,19 @@ protected Set adjacentVertices(Id source, EdgeStep step) { return neighbors; } - protected Set adjacentVertices(Set vertices, EdgeStep step, - Set excluded, long remaining) { + protected Set adjacentVertices(Id start, Set vertices, + EdgeStep step, Set excluded, + long remaining) { Set neighbors = newSet(); for (Node source : vertices) { Iterator edges = this.edgesOfVertex(source.id(), step); while (edges.hasNext()) { Id target = ((HugeEdge) edges.next()).id().otherVertexId(); KNode kNode = new KNode(target, (KNode) source); - if ((excluded != null && excluded.contains(kNode)) || - neighbors.contains(kNode)) { + boolean matchExcluded = (excluded != null && + excluded.contains(kNode)); + if (matchExcluded || neighbors.contains(kNode) || + start.equals(kNode.id())) { continue; } neighbors.add(kNode); @@ -367,7 +370,7 @@ public static void checkSkipDegree(long skipDegree, long degree, Query.DEFAULT_CAPACITY, skipDegree); if (capacity != NO_LIMIT) { E.checkArgument(degree != NO_LIMIT && degree < capacity, - "The degree must be < capacity"); + "The max degree must be < capacity"); E.checkArgument(skipDegree < capacity, "The skipped degree must be < capacity"); } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KneighborTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KneighborTraverser.java index bd306bf4df..189394ec12 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KneighborTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KneighborTraverser.java @@ -89,7 +89,7 @@ public Set customizedKneighbor(Id source, EdgeStep step, int maxDepth, while (maxDepth-- > 0) { long remaining = limit == NO_LIMIT ? NO_LIMIT : limit - all.size(); - latest = this.adjacentVertices(latest, step, all, + latest = this.adjacentVertices(source, latest, step, all, remaining, single); int size = all.size() + latest.size(); if (limit != NO_LIMIT && size >= limit) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KoutTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KoutTraverser.java index a6fa743dd6..f7a2a276f0 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KoutTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/KoutTraverser.java @@ -130,11 +130,11 @@ public Set customizedKout(Id source, EdgeStep step, int maxDepth, NO_LIMIT : capacity - latest.size(); while (depth-- > 0) { if (nearest) { - latest = this.adjacentVertices(latest, step, all, + latest = this.adjacentVertices(source, latest, step, all, remaining, single); all.addAll(latest); } else { - latest = this.adjacentVertices(latest, step, null, + latest = this.adjacentVertices(source, latest, step, null, remaining, single); } if (capacity != NO_LIMIT) { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java index 6433786717..339343e844 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java @@ -282,7 +282,8 @@ public void add(Node node) { public long degree() { E.checkArgument(this.degree > 0, - "The degree must be > 0, but got %s", this.degree); + "The max degree must be > 0, but got %s", + this.degree); return this.degree; } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java index 66135e7293..8dcd9909c7 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java @@ -81,11 +81,11 @@ public static void destroy() { } } - protected Set adjacentVertices(Set latest, EdgeStep step, - Set all, long remaining, - boolean single) { + protected Set adjacentVertices(Id source, Set latest, + EdgeStep step, Set all, + long remaining, boolean single) { if (single) { - return this.adjacentVertices(latest, step, all, remaining); + return this.adjacentVertices(source, latest, step, all, remaining); } else { AtomicLong remain = new AtomicLong(remaining); return this.adjacentVertices(latest, step, all, remain); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/EdgeStep.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/EdgeStep.java index 6a302d456f..b1d7ad1dad 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/EdgeStep.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/EdgeStep.java @@ -73,7 +73,7 @@ public EdgeStep(HugeGraph g, Directions direction, List labels, Map properties, long degree, long skipDegree) { E.checkArgument(degree == NO_LIMIT || degree > 0L, - "The degree must be > 0 or == -1, but got: %s", + "The max degree must be > 0 or == -1, but got: %s", degree); HugeTraverser.checkSkipDegree(skipDegree, degree, HugeTraverser.NO_LIMIT); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java index 91c3d84eb2..09218dee26 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/steps/WeightedEdgeStep.java @@ -71,8 +71,8 @@ public WeightedEdgeStep(HugeGraph g, Directions direction, List labels, "The sample must be > 0 or == -1, but got: %s", sample); E.checkArgument(maxDegree == NO_LIMIT || maxDegree >= sample, - "The max_degree must be greater than or equal to " + - "sample, but got max_degree %s and sample %s", + "The max degree must be greater than or equal to " + + "sample, but got max degree %s and sample %s", maxDegree, sample); this.edgeStep = new EdgeStep(g, direction, labels, properties, diff --git a/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java b/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java index 3bbfd9237d..f66cafb096 100644 --- a/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java +++ b/hugegraph-rocksdb/src/main/java/com/baidu/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java @@ -512,7 +512,7 @@ public static void initOptions(HugeConfig conf, E.checkArgument(compressions.isEmpty() || compressions.size() == numLevels, "Elements number of '%s' must be 0 or " + - "be the same as '%s', bug got %s != %s", + "be the same as '%s', but got %s != %s", RocksDBOptions.LEVELS_COMPRESSIONS.name(), RocksDBOptions.NUM_LEVELS.name(), compressions.size(), numLevels);