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

Method traverse

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

Source from the content-addressed store, hash-verified

2641 }
2642
2643 public *traverse(
2644 _source: GraphSource<any>,
2645 input: Iterable<unknown>,
2646 _context?: QueryContext,
2647 ): IterableIterator<number> {
2648 const { property } = this.config;
2649 let sum = 0;
2650 for (const path of input) {
2651 this.traversed++;
2652 if (path instanceof TraversalPath) {
2653 // If property is specified, get the property value; otherwise use the path value directly
2654 const value = property ? path.property(property as never) : path.value;
2655 if (typeof value === "number") {
2656 sum += value;
2657 }
2658 }
2659 }
2660 this.emitted++;
2661 yield sum;
2662 }
2663
2664 public override clone(partial?: Partial<AggregateStepConfig>) {
2665 const { config } = this;

Callers 15

handleAsyncQueryFunction · 0.45
traverseMethod · 0.45
resolveConditionValueFunction · 0.45
traverseMethod · 0.45
traverseMethod · 0.45
traverseMethod · 0.45
traverseMethod · 0.45
traverseMethod · 0.45
traverseMethod · 0.45
traverseMethod · 0.45
traverseFunction · 0.45
[Symbol.iterator]Function · 0.45

Calls 1

propertyMethod · 0.45

Tested by 15

executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
executeQueryFunction · 0.36
_executeQueryFunction · 0.36
executeQueryFunction · 0.36