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

Method isTarget

packages/graph/src/Steps.ts:5334–5350  ·  view source on GitHub ↗

* Check if a vertex matches the target criteria.

(
    vertex: Vertex<any, any>,
    targetId: ElementId | undefined,
    targetCondition: Condition | undefined,
  )

Source from the content-addressed store, hash-verified

5332 * Check if a vertex matches the target criteria.
5333 */
5334 private isTarget(
5335 vertex: Vertex<any, any>,
5336 targetId: ElementId | undefined,
5337 targetCondition: Condition | undefined,
5338 ): boolean {
5339 if (targetId !== undefined) {
5340 return vertex.id === targetId;
5341 }
5342
5343 if (targetCondition !== undefined) {
5344 // Create a temporary path to evaluate the condition
5345 const tempPath = new TraversalPath(undefined, vertex, []);
5346 return evaluateConditionFn(tempPath, targetCondition);
5347 }
5348
5349 return false;
5350 }
5351
5352 public override clone(partial?: Partial<ShortestPathStepConfig>) {
5353 const { config } = this;

Callers 2

bfsMethod · 0.95
dijkstraMethod · 0.95

Calls 1

evaluateConditionFnFunction · 0.85

Tested by

no test coverage detected