Skip to content

Commit

Permalink
fix: do not emit fetched cycles (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
zinic authored Feb 12, 2024
1 parent 8f2ec84 commit 9817ee1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/go/dawgs/traversal/traversal.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,17 @@ func (s *pattern) Driver(ctx context.Context, tx graph.Transaction, segment *gra
fetchFunc = func(cursor graph.Cursor[graph.DirectionalResult]) error {
for next := range cursor.Chan() {
nextSegment := segment.Descend(next.Node, next.Relationship)
nextSegment.Tag = &patternTag{
// Use the tag's patternIdx and depth since this is a continuation of the expansions
patternIdx: tag.patternIdx,
depth: tag.depth + 1,
}

nextSegments = append(nextSegments, nextSegment)
// Don't emit cycles out of the fetch
if !nextSegment.IsCycle() {
nextSegment.Tag = &patternTag{
// Use the tag's patternIdx and depth since this is a continuation of the expansions
patternIdx: tag.patternIdx,
depth: tag.depth + 1,
}

nextSegments = append(nextSegments, nextSegment)
}
}

return cursor.Error()
Expand Down

0 comments on commit 9817ee1

Please sign in to comment.