@tscircuit/capacity-autorouter 0.0.88 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -9615,16 +9615,34 @@ var NetToPointPairsSolver = class extends BaseSolver {
|
|
|
9615
9615
|
return;
|
|
9616
9616
|
}
|
|
9617
9617
|
const connection = this.unprocessedConnections.pop();
|
|
9618
|
+
const externalGroups = connection.externallyConnectedPointIds ?? [];
|
|
9619
|
+
const pointIdToGroup = /* @__PURE__ */ new Map();
|
|
9620
|
+
externalGroups.forEach(
|
|
9621
|
+
(group, idx) => group.forEach((pid) => pointIdToGroup.set(pid, idx))
|
|
9622
|
+
);
|
|
9623
|
+
const areExternallyConnected = (a, b) => {
|
|
9624
|
+
if (!a.pointId || !b.pointId) return false;
|
|
9625
|
+
const g1 = pointIdToGroup.get(a.pointId);
|
|
9626
|
+
const g2 = pointIdToGroup.get(b.pointId);
|
|
9627
|
+
return g1 !== void 0 && g1 === g2;
|
|
9628
|
+
};
|
|
9618
9629
|
if (connection.pointsToConnect.length === 2) {
|
|
9630
|
+
if (areExternallyConnected(
|
|
9631
|
+
connection.pointsToConnect[0],
|
|
9632
|
+
connection.pointsToConnect[1]
|
|
9633
|
+
)) {
|
|
9634
|
+
return;
|
|
9635
|
+
}
|
|
9619
9636
|
this.newConnections.push(connection);
|
|
9620
9637
|
return;
|
|
9621
9638
|
}
|
|
9622
9639
|
const edges = buildMinimumSpanningTree(connection.pointsToConnect);
|
|
9623
|
-
|
|
9624
|
-
|
|
9640
|
+
let mstIdx = 0;
|
|
9641
|
+
for (const edge of edges) {
|
|
9642
|
+
if (areExternallyConnected(edge.from, edge.to)) continue;
|
|
9625
9643
|
this.newConnections.push({
|
|
9626
9644
|
pointsToConnect: [edge.from, edge.to],
|
|
9627
|
-
name: `${connection.name}_mst${
|
|
9645
|
+
name: `${connection.name}_mst${mstIdx++}`
|
|
9628
9646
|
});
|
|
9629
9647
|
}
|
|
9630
9648
|
}
|