Skip to content
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(api-core): support label & property filtering for both edge and vertex & support kout dfs mode #2295

Merged
merged 19 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public String post(@Context GraphManager manager,
E.checkArgument(!request.withVertex && !request.withPath && !request.withEdge,
"Can't return vertex, edge or path when count only");
}
HugeTraverser.checkTraverseMode(request.algorithm);
HugeTraverser.checkTraverseMode(request.traverse_mode);

LOG.debug("Graph [{}] get customized kout from source vertex '{}', " +
"with steps '{}', max_depth '{}', nearest '{}', " +
Expand All @@ -151,7 +151,7 @@ public String post(@Context GraphManager manager,
Steps steps = steps(g, request.steps);
KoutRecords results;
try (KoutTraverser traverser = new KoutTraverser(g)) {
if (HugeTraverser.isTraverseModeDFS(request.algorithm)) {
if (HugeTraverser.isTraverseModeDFS(request.traverse_mode)) {
results = traverser.dfsKout(sourceId, steps,
request.maxDepth,
request.nearest,
Expand Down Expand Up @@ -237,19 +237,19 @@ private static class Request {
public boolean withPath = false;
@JsonProperty("with_edge")
public boolean withEdge = false;
@JsonProperty("algorithm")
public String algorithm = HugeTraverser.TRAVERSE_MODE_BFS;
@JsonProperty("traverse_mode")
public String traverse_mode = HugeTraverser.TRAVERSE_MODE_BFS;
DanGuge marked this conversation as resolved.
Show resolved Hide resolved

@Override
public String toString() {
return String.format("KoutRequest{source=%s,steps=%s,maxDepth=%s" +
"nearest=%s,countOnly=%s,capacity=%s," +
"limit=%s,withVertex=%s,withPath=%s," +
"withEdge=%s,algorithm=%s}", this.source,
"withEdge=%s,traverse_mode=%s}", this.source,
DanGuge marked this conversation as resolved.
Show resolved Hide resolved
this.steps, this.maxDepth, this.nearest,
this.countOnly, this.capacity, this.limit,
this.withVertex, this.withPath, this.withEdge,
this.algorithm);
this.traverse_mode);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class HugeTraverser {
// Empirical value of scan limit, with which results can be returned in 3s
public static final String DEFAULT_PAGE_LIMIT = "100000";
public static final long NO_LIMIT = -1L;
// kout traverse mode algorithms: bfs and dfs
// traverse mode of kout algorithm: bfs and dfs
public static final String TRAVERSE_MODE_BFS = "breadth_first_search";
public static final String TRAVERSE_MODE_DFS = "depth_first_search";
protected static final Logger LOG = Log.logger(HugeTraverser.class);
Expand Down Expand Up @@ -178,8 +178,8 @@ public static void checkTraverseMode(String traverseMode) {
TRAVERSE_MODE_BFS, TRAVERSE_MODE_DFS, traverseMode);
}

public static boolean isTraverseModeDFS(String algorithm) {
return algorithm.compareToIgnoreCase(TRAVERSE_MODE_DFS) == 0;
public static boolean isTraverseModeDFS(String traverse_mode) {
DanGuge marked this conversation as resolved.
Show resolved Hide resolved
return traverse_mode.compareToIgnoreCase(TRAVERSE_MODE_DFS) == 0;
}

public static <K, V extends Comparable<? super V>> Map<K, V> topN(
Expand Down