You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/02/20 00:50:00 UTC
[jira] [Commented] (TINKERPOP-1822) Repeat should depth first
search
[ https://issues.apache.org/jira/browse/TINKERPOP-1822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369619#comment-16369619 ]
ASF GitHub Bot commented on TINKERPOP-1822:
-------------------------------------------
Github user krlohnes commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/715#discussion_r169194905
--- Diff: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java ---
@@ -271,7 +274,17 @@ public RepeatEndStep(final Traversal.Admin traversal) {
protected Iterator<Traverser.Admin<S>> standardAlgorithm() throws NoSuchElementException {
final RepeatStep<S> repeatStep = (RepeatStep<S>) this.getTraversal().getParent();
while (true) {
- final Traverser.Admin<S> start = this.starts.next();
+ final Traverser.Admin<S> start;
+ if (this.starts.hasNext()) {
+ start = this.starts.next();
+ } else {
+ start = this.stashedStarts.pop();
+ }
+ // to make this step depth first search (DFS), we're stashing the remainder for later
+ while (this.starts.hasNext()) {
+ stashedStarts.add(this.starts.next());
--- End diff --
I think this should be `push` rather than `add` so you maintain a consistent `stack` behavior for a DFS.
> Repeat should depth first search
> --------------------------------
>
> Key: TINKERPOP-1822
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1822
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.3.0, 3.2.6
> Reporter: Robert Dale
> Priority: Major
>
> Perhaps optionally.
> See also:
> * https://groups.google.com/forum/#!topic/gremlin-users/gLSLxH_K-wE
> * https://github.com/apache/tinkerpop/pull/715
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)