Skip to content
Permalink
Browse files
test: adapt for server OLTP algorithm ( 'max_degree ' & kneighbor) (#122
)
  • Loading branch information
imbajin committed May 27, 2021
1 parent 166a3fe commit 621c0b2df34e83e6010c0efdcb2b9cccf0b7cd17
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 85 deletions.
@@ -27,4 +27,4 @@ after_success:
env:
global:
- TRAVIS_DIR=assembly/travis
- COMMIT_ID=c0dff5b233e853716ca6f3f28a5cda05e6f3d639
- COMMIT_ID=9ef6796dc9c60679ffbe49e60fe31c7d23818f55
@@ -5,7 +5,7 @@

<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-client</artifactId>
<version>1.9.3</version>
<version>1.9.4</version>
<packaging>jar</packaging>

<name>hugegraph-client</name>
@@ -140,7 +140,7 @@ public static class Step {
private Step() {
this.direction = null;
this.labels = new ArrayList<>();
this.degree = Traverser.DEFAULT_DEGREE;
this.degree = Traverser.DEFAULT_MAX_DEGREE;
this.top = (int) Traverser.DEFAULT_PATHS_LIMIT;
}

@@ -50,8 +50,8 @@ public static class Request {
private String label;
@JsonProperty("alpha")
private double alpha = Traverser.DEFAULT_ALPHA;
@JsonProperty("degree")
public long degree = Traverser.DEFAULT_DEGREE;
@JsonProperty("max_degree")
public long degree = Traverser.DEFAULT_MAX_DEGREE;
@JsonProperty("limit")
private long limit = Traverser.DEFAULT_LIMIT;
@JsonProperty("max_depth")
@@ -97,7 +97,7 @@ private void initManagers(RestClient client, String graph) {
private void checkServerApiVersion() {
VersionUtil.Version apiVersion = VersionUtil.Version.of(
this.version.getApiVersion());
VersionUtil.check(apiVersion, "0.38", "0.60",
VersionUtil.check(apiVersion, "0.38", "0.62",
"hugegraph-api in server");
this.client.apiVersion(apiVersion);
}
@@ -75,7 +75,7 @@
import com.baidu.hugegraph.util.E;

import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_CAPACITY;
import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_DEGREE;
import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_MAX_DEGREE;
import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_ELEMENTS_LIMIT;
import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_PAGE_LIMIT;
import static com.baidu.hugegraph.structure.constant.Traverser.DEFAULT_PATHS_LIMIT;
@@ -138,7 +138,7 @@ public TraverserManager(RestClient client, GraphManager graphManager) {
}

public double jaccardSimilarity(Object vertexId, Object otherId) {
return this.jaccardSimilarity(vertexId, otherId, DEFAULT_DEGREE);
return this.jaccardSimilarity(vertexId, otherId, DEFAULT_MAX_DEGREE);
}

public double jaccardSimilarity(Object vertexId, Object otherId,
@@ -160,7 +160,7 @@ public Map<Object, Double> jaccardSimilarity(
}

public List<Object> sameNeighbors(Object vertexId, Object otherId) {
return this.sameNeighbors(vertexId, otherId, DEFAULT_DEGREE);
return this.sameNeighbors(vertexId, otherId, DEFAULT_MAX_DEGREE);
}

public List<Object> sameNeighbors(Object vertexId, Object otherId,
@@ -197,7 +197,7 @@ public Path shortestPath(Object sourceId, Object targetId,
public Path shortestPath(Object sourceId, Object targetId,
Direction direction, String label, int maxDepth) {
return this.shortestPath(sourceId, targetId, direction, label, maxDepth,
DEFAULT_DEGREE, DEFAULT_CAPACITY);
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY);
}

public Path shortestPath(Object sourceId, Object targetId,
@@ -230,7 +230,7 @@ public List<Path> allShortestPaths(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth) {
return this.allShortestPaths(sourceId, targetId, direction,
label, maxDepth, DEFAULT_DEGREE,
label, maxDepth, DEFAULT_MAX_DEGREE,
DEFAULT_CAPACITY);
}

@@ -263,7 +263,7 @@ public WeightedPaths singleSourceShortestPath(Object sourceId,
String label, String weight,
boolean withVertex) {
return this.singleSourceShortestPath(sourceId, direction, label, weight,
DEFAULT_DEGREE, 0L,
DEFAULT_MAX_DEGREE, 0L,
DEFAULT_CAPACITY,
DEFAULT_PATHS_LIMIT, withVertex);
}
@@ -291,7 +291,7 @@ public WeightedPath weightedShortestPath(Object sourceId, Object targetId,
String weight,
boolean withVertex) {
return this.weightedShortestPath(sourceId, targetId, direction, label,
weight, DEFAULT_DEGREE, 0L,
weight, DEFAULT_MAX_DEGREE, 0L,
DEFAULT_CAPACITY, withVertex);
}

@@ -326,7 +326,7 @@ public List<Path> paths(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long limit) {
return this.paths(sourceId, targetId, direction, label, maxDepth,
DEFAULT_DEGREE, DEFAULT_CAPACITY, limit);
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
}

public List<Path> paths(Object sourceId, Object targetId,
@@ -357,7 +357,7 @@ public List<Path> crosspoint(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long limit) {
return this.crosspoint(sourceId, targetId, direction, label, maxDepth,
DEFAULT_DEGREE, DEFAULT_CAPACITY, limit);
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
}

public List<Path> crosspoint(Object sourceId, Object targetId,
@@ -379,7 +379,7 @@ public List<Object> kout(Object sourceId, Direction direction, int depth) {
public List<Object> kout(Object sourceId, Direction direction,
String label, int depth, boolean nearest) {
return this.kout(sourceId, direction, label, depth, nearest,
DEFAULT_DEGREE, DEFAULT_CAPACITY,
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY,
DEFAULT_ELEMENTS_LIMIT);
}

@@ -406,7 +406,7 @@ public List<Object> kneighbor(Object sourceId, Direction direction,
public List<Object> kneighbor(Object sourceId, Direction direction,
String label, int depth) {
return this.kneighbor(sourceId, direction, label, depth,
DEFAULT_DEGREE, DEFAULT_ELEMENTS_LIMIT);
DEFAULT_MAX_DEGREE, DEFAULT_ELEMENTS_LIMIT);
}

public List<Object> kneighbor(Object sourceId, Direction direction,
@@ -426,7 +426,7 @@ public long count(CountRequest request) {

public List<Path> rings(Object sourceId, int depth) {
return this.rings(sourceId, Direction.BOTH, null, depth, true,
DEFAULT_DEGREE, DEFAULT_CAPACITY,
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY,
DEFAULT_ELEMENTS_LIMIT);
}

@@ -438,8 +438,9 @@ public List<Path> rings(Object sourceId, Direction direction, String label,
}

public List<Path> rays(Object sourceId, int depth) {
return this.rays(sourceId, Direction.BOTH, null, depth, DEFAULT_DEGREE,
DEFAULT_CAPACITY, DEFAULT_ELEMENTS_LIMIT);
return this.rays(sourceId, Direction.BOTH, null, depth,
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY,
DEFAULT_ELEMENTS_LIMIT);
}

public List<Path> rays(Object sourceId, Direction direction, String label,
@@ -24,7 +24,7 @@ public class Traverser {
public static final long DEFAULT_CAPACITY = 10_000_000L;
public static final long DEFAULT_LIMIT = 100L;
public static final long DEFAULT_ELEMENTS_LIMIT = 10_000_000L;
public static final long DEFAULT_DEGREE = 10_000L;
public static final long DEFAULT_MAX_DEGREE = 10_000L;
public static final long DEFAULT_CROSSPOINT_LIMIT = 10_000L;
public static final long DEFAULT_PATHS_LIMIT = 10L;
public static final long DEFAULT_DEDUP_SIZE = 1_000_000L;
@@ -179,7 +179,7 @@ private Step() {
this.direction = null;
this.labels = new ArrayList<>();
this.properties = new HashMap<>();
this.degree = Traverser.DEFAULT_DEGREE;
this.degree = Traverser.DEFAULT_MAX_DEGREE;
}

@Override
@@ -153,7 +153,7 @@ private Step() {
this.properties = new HashMap<>();
this.weightBy = null;
this.defaultWeight = Traverser.DEFAULT_WEIGHT;
this.degree = Traverser.DEFAULT_DEGREE;
this.degree = Traverser.DEFAULT_MAX_DEGREE;
this.sample = Traverser.DEFAULT_SAMPLE;
}

@@ -47,7 +47,7 @@ protected EdgeStep() {
this.direction = Direction.BOTH;
this.labels = new ArrayList<>();
this.properties = new HashMap<>();
this.degree = Traverser.DEFAULT_DEGREE;
this.degree = Traverser.DEFAULT_MAX_DEGREE;
this.skipDegree = Traverser.DEFAULT_SKIP_DEGREE;
}

@@ -61,7 +61,7 @@ private FusiformSimilarityRequest() {
this.label = null;
this.direction = null;
this.minNeighbors = 0;
this.degree = Traverser.DEFAULT_DEGREE;
this.degree = Traverser.DEFAULT_MAX_DEGREE;
this.alpha = 1.0f;
this.minSimilars = 1;
this.top = 0;

0 comments on commit 621c0b2

Please sign in to comment.