MCPcopy Create free account
hub / github.com/codemix/graph / traverse

Method traverse

packages/graph/src/Steps.ts:559–582  ·  view source on GitHub ↗
(
    _source: GraphSource<any>,
    input: Iterable<TraversalPath<any, any, any>>,
    _context?: QueryContext,
  )

Source from the content-addressed store, hash-verified

557 }
558
559 public *traverse(
560 _source: GraphSource<any>,
561 input: Iterable<TraversalPath<any, any, any>>,
562 _context?: QueryContext,
563 ): IterableIterator<TraversalPath<any, any, any>> {
564 // Check if there's already valid TraversalPath input - if so, pass it through
565 let hasValidInput = false;
566 for (const path of input) {
567 // Only yield actual TraversalPath instances, not undefined or other values
568 if (path instanceof TraversalPath) {
569 hasValidInput = true;
570 this.traversed++;
571 this.emitted++;
572 yield path;
573 }
574 }
575
576 // If no valid input was provided, yield a single empty path to start the traversal
577 if (!hasValidInput) {
578 this.traversed++;
579 this.emitted++;
580 yield new TraversalPath(undefined, undefined, []);
581 }
582 }
583
584 public override clone(partial?: Partial<StartStepConfig>) {
585 return new StartStep({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected