(
source: GraphSource<any>,
input: Iterable<TraversalPath<any, any, any>>,
_context?: QueryContext,
)
| 3545 | } |
| 3546 | |
| 3547 | public *traverse( |
| 3548 | source: GraphSource<any>, |
| 3549 | input: Iterable<TraversalPath<any, any, any>>, |
| 3550 | _context?: QueryContext, |
| 3551 | ): IterableIterator<TraversalPath<any, any, any>> { |
| 3552 | const { direction, edgeLabels, stepLabels } = this.config; |
| 3553 | for (const path of input) { |
| 3554 | this.traversed++; |
| 3555 | const value = path.value; |
| 3556 | if (value === undefined) continue; |
| 3557 | if (value instanceof Vertex) { |
| 3558 | if (direction === "in" || direction === "both") { |
| 3559 | for (const edge of source.getIncomingEdges(value.id)) { |
| 3560 | this.traversed++; |
| 3561 | if (edgeLabels.length === 0 || edgeLabels.includes(edge.label)) { |
| 3562 | this.emitted++; |
| 3563 | yield path.with(edge, stepLabels); |
| 3564 | } |
| 3565 | } |
| 3566 | } |
| 3567 | if (direction === "out" || direction === "both") { |
| 3568 | for (const edge of source.getOutgoingEdges(value.id)) { |
| 3569 | this.traversed++; |
| 3570 | if (edgeLabels.length === 0 || edgeLabels.includes(edge.label)) { |
| 3571 | // For direction='both', skip self-loops since they were already |
| 3572 | // yielded in the incoming edges pass above |
| 3573 | const storedEdge = edge[$StoredElement]; |
| 3574 | if (direction === "both" && storedEdge.inV === storedEdge.outV) { |
| 3575 | continue; |
| 3576 | } |
| 3577 | this.emitted++; |
| 3578 | yield path.with(edge, stepLabels); |
| 3579 | } |
| 3580 | } |
| 3581 | } |
| 3582 | } else if (value instanceof Edge) { |
| 3583 | this.emitted++; |
| 3584 | yield path; |
| 3585 | } |
| 3586 | } |
| 3587 | } |
| 3588 | |
| 3589 | public override clone(partial?: Partial<EdgeStepConfig>) { |
| 3590 | const { config } = this; |
nothing calls this directly
no test coverage detected