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

Function selectionReach

ui/src/lib/steps-model.ts:1129–1146  ·  view source on GitHub ↗
(model: StepsModel, selected: string)

Source from the content-addressed store, hash-verified

1127 * points alone; a picture without forks is just the selection.
1128 */
1129export function selectionReach(model: StepsModel, selected: string): ReadonlySet<string> {
1130 const reach = new Set([selected]);
1131 if (model.forks === null || model.forks.size === 0) return reach;
1132 for (let grew = true; grew; ) {
1133 grew = false;
1134 for (const e of model.layout.edges) {
1135 const from = reach.has(e.source);
1136 const to = reach.has(e.target);
1137 if (from === to) continue;
1138 const other = from ? e.target : e.source;
1139 if (model.forks.has(other) && !reach.has(other)) {
1140 reach.add(other);
1141 grew = true;
1142 }
1143 }
1144 }
1145 return reach;
1146}
1147
1148/**
1149 * Which edges draw, given the selection. Selecting a step says "show me

Callers 2

stepEdgeVisibleFunction · 0.85

Calls 2

hasMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected