MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / rows

Function rows

ui/src/lib/program-model.ts:260–277  ·  view source on GitHub ↗

* The row each step sits on: the longest run of "and then" from the anchor to * it, so a step never draws above something that has to happen first. * * A step reached twice (`session.add` before and after a check, a logout * helper the code comes back to) makes the graph cyclic, and relaxing ove

(anchor: string, nodes: ReadonlySet<string>, edges: readonly OrderEdge[])

Source from the content-addressed store, hash-verified

258 * and no picture is ever taller than it has boxes.
259 */
260function rows(anchor: string, nodes: ReadonlySet<string>, edges: readonly OrderEdge[]): Map<string, number> {
261 const forward = withoutBackEdges(anchor, nodes, edges);
262 const depth = new Map<string, number>();
263 for (const id of nodes) depth.set(id, 0);
264 depth.set(anchor, 0);
265 for (let pass = 0; pass < nodes.size; pass++) {
266 let moved = false;
267 for (const e of forward) {
268 const next = (depth.get(e.from) ?? 0) + 1;
269 if (next > (depth.get(e.to) ?? 0)) {
270 depth.set(e.to, next);
271 moved = true;
272 }
273 }
274 if (!moved) break;
275 }
276 return depth;
277}
278
279/**
280 * The edges minus the ones that close a cycle — those whose end is still open

Callers 1

orderGraphFunction · 0.85

Calls 3

withoutBackEdgesFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected