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

Method length

packages/graph/src/Traversals.ts:187–195  ·  view source on GitHub ↗

* Return the number of edges/relationships in this path. * Mirrors Cypher's `length(path)`.

()

Source from the content-addressed store, hash-verified

185 * Mirrors Cypher's `length(path)`.
186 */
187 public length(): number {
188 let edgeCount = 0;
189 for (const step of this) {
190 if (step.value instanceof Edge) {
191 edgeCount++;
192 }
193 }
194 return edgeCount;
195 }
196
197 /**
198 * Sum a numeric property across all items in the path.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected