import { BaseSolver } from '@tscircuit/solver-utils'; import { GraphicsObject } from 'graphics-debug'; import { Matrix } from 'transformation-matrix'; type PortId = string; type GraphEdgeId = string; type RegionId = string; type ConnectionId = string; type NetworkId = string; type GScore = number; type RegionPort = { portId: PortId; region1: Region; region2: Region; d: any; assignment?: PortAssignment; /** * The number of times this port has been ripped. Can be used to penalize * ports that are likely to block off connections */ ripCount?: number; /** * Optionally can be used by solvers to keep track of the distance to * each end era. */ distanceToEndMap?: Record; }; type Region = { regionId: RegionId; ports: RegionPort[]; d: any; assignments?: RegionPortAssignment[]; }; type PortAssignment = { solvedRoute: SolvedRoute; connection: Connection; }; type RegionPortAssignment = { regionPort1: RegionPort; regionPort2: RegionPort; region: Region; connection: Connection; solvedRoute: SolvedRoute; }; type SolvedRoute = { path: Candidate[]; connection: Connection; requiredRip: boolean; }; type Candidate = { port: RegionPortType; g: number; h: number; f: number; hops: number; parent?: Candidate; lastPort?: RegionPortType; lastRegion?: RegionType; nextRegion?: RegionType; ripRequired: boolean; }; type HyperGraph = { ports: RegionPort[]; regions: Region[]; }; type SerializedGraphPort = { portId: PortId; region1Id: RegionId; region2Id: RegionId; d: any; }; type SerializedGraphRegion = { regionId: RegionId; pointIds: PortId[]; d: any; assignments?: SerializedRegionPortAssignment[]; }; type SerializedRegionPortAssignment = { regionPort1Id: PortId; regionPort2Id: PortId; connectionId: ConnectionId; }; type SerializedHyperGraph = { ports: SerializedGraphPort[]; regions: SerializedGraphRegion[]; solvedRoutes?: SerializedSolvedRoute[]; connections?: SerializedConnection[]; _sectionRouteBindings?: SerializedSectionRouteBinding[]; _sectionCentralRegionId?: RegionId; }; type SerializedCandidate = { portId: PortId; g: number; h: number; f: number; hops: number; ripRequired: boolean; lastPortId?: PortId; lastRegionId?: RegionId; nextRegionId?: RegionId; }; type SerializedSolvedRoute = { path: SerializedCandidate[]; connection: SerializedConnection; requiredRip: boolean; }; type SerializedSectionRouteBinding = { connectionId: ConnectionId; solvedPathStartIndex: number; solvedPathEndIndex: number; }; type Connection = { connectionId: ConnectionId; mutuallyConnectedNetworkId: NetworkId; startRegion: Region; endRegion: Region; startPortId?: PortId; endPortId?: PortId; }; type SerializedConnection = { connectionId: ConnectionId; startRegionId: RegionId; endRegionId: RegionId; startPortId?: PortId; endPortId?: PortId; mutuallyConnectedNetworkId?: NetworkId; }; declare const convertConnectionsToSerializedConnections: (connections: Connection[]) => SerializedConnection[]; declare const convertHyperGraphToSerializedHyperGraph: (graph: HyperGraph) => SerializedHyperGraph; declare const createBlankHyperGraph: (inputGraph: SerializedHyperGraph) => SerializedHyperGraph; declare const extractSectionOfHyperGraph: (input: { graph: SerializedHyperGraph; centralRegionId: RegionId; expansionHopsFromCentralRegion: number; }) => SerializedHyperGraph; type Node = { f: number; [key: string]: any; }; declare class PriorityQueue { private heap; private maxSize; /** * Creates a new Priority Queue. * @param nodes An optional initial array of nodes to populate the queue. * @param maxSize The maximum number of elements the queue can hold. Defaults to 10,000. */ constructor(nodes?: T[], maxSize?: number); /** * Returns the number of elements currently in the queue. */ get size(): number; /** * Checks if the queue is empty. */ isEmpty(): boolean; /** * Returns the node with the highest priority (smallest 'f') without removing it. * Returns null if the queue is empty. * @returns The highest priority node or null. */ peek(): T | null; /** * Returns up to N nodes with the highest priority (smallest 'f') without removing them. * Nodes are returned sorted by priority (smallest 'f' first). * @param count Maximum number of nodes to return. * @returns Array of nodes sorted by priority. */ peekMany(count: number): T[]; /** * Removes and returns the node with the highest priority (smallest 'f'). * Returns null if the queue is empty. * Maintains the heap property. * @returns The highest priority node or null. */ dequeue(): T | null; /** * Adds a new node to the queue. * Maintains the heap property. * If the queue is full (at maxSize), the node is not added. * @param node The node to add. */ enqueue(node: T): void; /** * Moves the node at the given index up the heap to maintain the heap property. * @param index The index of the node to sift up. */ private _siftUp; /** * Moves the node at the given index down the heap to maintain the heap property. * @param index The index of the node to sift down. */ private _siftDown; /** * Swaps two elements in the heap array. * @param i Index of the first element. * @param j Index of the second element. */ private _swap; /** Calculates the parent index of a node. */ private _parentIndex; /** Calculates the left child index of a node. */ private _leftChildIndex; /** Calculates the right child index of a node. */ private _rightChildIndex; } declare class HyperGraphSolver = Candidate> extends BaseSolver { input: { inputGraph: HyperGraph | SerializedHyperGraph; inputConnections: (Connection | SerializedConnection)[]; greedyMultiplier?: number; rippingEnabled?: boolean; ripCost?: number; inputSolvedRoutes?: SolvedRoute[]; }; getSolverName(): string; graph: HyperGraph; connections: Connection[]; candidateQueue: PriorityQueue; unprocessedConnections: Connection[]; solvedRoutes: SolvedRoute[]; currentConnection: Connection | null; currentEndRegion: Region | null; greedyMultiplier: number; rippingEnabled: boolean; ripCost: number; lastCandidate: Candidate | null; visitedPointsForCurrentConnection: Map; constructor(input: { inputGraph: HyperGraph | SerializedHyperGraph; inputConnections: (Connection | SerializedConnection)[]; greedyMultiplier?: number; rippingEnabled?: boolean; ripCost?: number; inputSolvedRoutes?: SolvedRoute[]; }); getConstructorParams(): { inputGraph: SerializedHyperGraph; inputConnections: SerializedConnection[]; greedyMultiplier: number; rippingEnabled: boolean; ripCost: number; inputSolvedRoutes: SolvedRoute[]; }; computeH(candidate: CandidateType): number; /** * OVERRIDE THIS * * Return the estimated remaining cost to the end of the route. You must * first understand the UNIT of your costs. If it's distance, then this could * be something like distance(port, this.currentEndRegion.d.center) */ estimateCostToEnd(port: RegionPortType): number; /** * OPTIONALLY OVERRIDE THIS * * This is a penalty for using a port that is not relative to a connection, * e.g. maybe this port is in a special area of congestion. Use this to * penalize ports that are e.g. likely to block off connections, you may want * to use port.ripCount to help determine this penalty, or you can use port * position, region volume etc. */ getPortUsagePenalty(port: RegionPortType): number; /** * OVERRIDE THIS * * Return the cost of using two ports in the region, make sure to consider * existing assignments. You may use this to penalize intersections */ computeIncreasedRegionCostIfPortsAreUsed(region: RegionType, port1: RegionPortType, port2: RegionPortType): number; /** * OPTIONALLY OVERRIDE THIS * * Return the assignments that would need to be ripped if the given ports * are used together in the region. This is used to determine if adopting * a route would require ripping other routes due to problematic crossings. */ getRipsRequiredForPortUsage(_region: RegionType, _port1: RegionPortType, _port2: RegionPortType): RegionPortAssignment[]; /** * OPTIONALLY OVERRIDE THIS * * Return true if using the candidate transition should incur ripCost even * when there is no direct port-assignment conflict. */ isRipRequiredForPortUsage(_region: RegionType, _port1: RegionPortType, _port2: RegionPortType): boolean; /** * OPTIONALLY OVERRIDE THIS * * Return false to prevent transitioning through a region from `_port1` to * `_port2`. */ isTransitionAllowed(_region: RegionType, _port1: RegionPortType, _port2: RegionPortType): boolean; computeG(candidate: CandidateType): number; /** * Return a subset of the candidates for entering a region. These candidates * are all possible ways to enter the region- you can e.g. return the middle * port to make it so that you're not queueing candidates that are likely * redundant. */ selectCandidatesForEnteringRegion(candidates: Candidate[]): Candidate[]; /** * OPTIONALLY OVERRIDE THIS * * Compute the full set of solved routes that must be ripped to accept * `newlySolvedRoute`. By default this returns all conflicting routes * (always-rip behavior) * * Override this to implement partial ripping, where only a subset of * conflicting routes are removed. */ computeRoutesToRip(newlySolvedRoute: SolvedRoute): Set; /** * Returns solved routes that overlap ports with the newly solved route. * Use this in computeRoutesToRip overrides to include port reuse rips. */ computePortOverlapRoutes(newlySolvedRoute: SolvedRoute): Set; computeCrossingRoutes(newlySolvedRoute: SolvedRoute): Set; getNextCandidates(currentCandidate: CandidateType): CandidateType[]; processSolvedRoute(finalCandidate: CandidateType): void; /** * OPTIONALLY OVERRIDE THIS * * You can override this to perform actions after a route is solved, e.g. * you may want to detect if a solvedRoute.requiredRip is true, in which * case you might want to execute a "random rip" to avoid loops or check * if we've exceeded a maximum number of rips. * * You can also use this to shuffle unprocessed routes if a rip occurred, this * can also help avoid loops */ routeSolvedHook(solvedRoute: SolvedRoute): void; /** * OPTIONALLY OVERRIDE THIS * * You can override this to perform actions when a new route begins, e.g. * you may want to log or track which connection is being processed. */ routeStartedHook(connection: Connection): void; ripSolvedRoute(solvedRoute: SolvedRoute): void; beginNewConnection(): void; _step(): void; } declare const reattachSectionToGraph: (input: { fullGraph: SerializedHyperGraph; solvedSectionGraph: SerializedHyperGraph; }) => SerializedHyperGraph; declare const pruneDeadEndPorts: (graph: HyperGraph, retainedPortIds?: Iterable) => HyperGraph; type CreateHyperGraphSolverInput = { inputGraph: HyperGraph | SerializedHyperGraph; inputConnections: (Connection | SerializedConnection)[]; inputSolvedRoutes: SolvedRoute[]; }; type CreateHyperGraphSolver = (input: CreateHyperGraphSolverInput) => HyperGraphSolver; type SectionRoute = { globalRoute: SolvedRoute; globalConnection: Connection; sectionConnection: Connection; sectionRoute: SolvedRoute; canRemainFixedInSectionSolve: boolean; sectionStartIndex: number; sectionEndIndex: number; }; type HyperGraphSection = { centralRegionId: RegionId; sectionRegionIds: Set; graph: HyperGraph; connections: Connection[]; sectionRoutes: SectionRoute[]; }; declare class HyperGraphSectionOptimizer extends BaseSolver { input: { hyperGraphSolver: HyperGraphSolver; inputSolvedRoutes: SolvedRoute[]; expansionHopsFromCentralRegion: number; createHyperGraphSolver: CreateHyperGraphSolver; regionCost: (region: Region) => number; effort: number; ACCEPTABLE_REGION_COST: number; MAX_ATTEMPTS_PER_REGION: number; MAX_ATTEMPTS_PER_SECTION?: number; FRACTION_TO_REPLACE?: number; alwaysRipConflicts?: boolean; computeSolvedGraphCost?: (solvedRoutes: SolvedRoute[]) => number; }; graph: HyperGraph; connections: Connection[]; solvedRoutes: SolvedRoute[]; activeSection: HyperGraphSection | null; baselineSectionCost: number; baselineGlobalCost: number; regionAttemptCounts: Map; sectionAttempts: number; maxAttemptsPerRegion: number; maxSectionAttempts: number; fractionToReplace: number; alwaysRipConflicts: boolean; random: () => number; activeSubSolver: HyperGraphSolver | null; constructor(input: { hyperGraphSolver: HyperGraphSolver; inputSolvedRoutes: SolvedRoute[]; expansionHopsFromCentralRegion: number; createHyperGraphSolver: CreateHyperGraphSolver; regionCost: (region: Region) => number; effort: number; ACCEPTABLE_REGION_COST: number; MAX_ATTEMPTS_PER_REGION: number; MAX_ATTEMPTS_PER_SECTION?: number; FRACTION_TO_REPLACE?: number; alwaysRipConflicts?: boolean; computeSolvedGraphCost?: (solvedRoutes: SolvedRoute[]) => number; }); getSolverName(): string; getConstructorParams(): { inputGraph: SerializedHyperGraph; inputConnections: SerializedConnection[]; inputSolvedRoutes: SolvedRoute[]; expansionHopsFromCentralRegion: number; maxAttemptsPerRegion: number; maxSectionAttempts: number; effort: number; fractionToReplace: number; alwaysRipConflicts: boolean; ACCEPTABLE_COST: number; }; getOutput(): SolvedRoute[]; _setup(): void; visualize(): GraphicsObject; getCostOfRegionWithAttempts(region: Region): number; computeCostOfSection({ section, solvedRoutes, }: { section: HyperGraphSection; solvedRoutes: SolvedRoute[]; }): number; private computeSolvedGraphCost; /** * TODO default behavior should be to rip entire section */ determineConnectionsToRip(section: HyperGraphSection, evaluationSolver: HyperGraphSolver): Set; private getNextCentralRegion; private beginSectionSolve; _step(): void; } type CreateSectionSolverInput = { inputGraph: SerializedHyperGraph; inputConnections: SerializedConnection[]; inputSolvedRoutes: SerializedSolvedRoute[]; }; type HyperGraphSectionOptimizer2Input = { inputGraph: SerializedHyperGraph; inputConnections?: SerializedConnection[]; inputSolvedRoutes?: SerializedSolvedRoute[]; sectionExpansionHops?: number; maxTargetRegionAttempts?: number; maxSectionAttempts?: number; minCentralRegionCost?: number; effort?: number; expansionHopsFromCentralRegion?: number; MAX_ATTEMPTS_PER_REGION?: number; MAX_ATTEMPTS_PER_SECTION?: number; ACCEPTABLE_CENTRAL_REGION_COST?: number; ACCEPTABLE_CENTRAL_REGION_COST_START?: number; ACCEPTABLE_CENTRAL_REGION_COST_END?: number; }; type NormalizedHyperGraphSectionOptimizer2Input = { inputGraph: SerializedHyperGraph; inputConnections: SerializedConnection[]; inputSolvedRoutes: SerializedSolvedRoute[]; sectionExpansionHops: number; maxTargetRegionAttempts: number; maxSectionAttempts: number; minCentralRegionCost: number; centralRegionCostStart?: number; centralRegionCostEnd?: number; effort: number; }; type SectionSolveAttempt = { targetRegionId: RegionId; sectionRegionIds: Set; fullGraphSnapshot: SerializedHyperGraph; blankSectionProblem: SerializedHyperGraph; currentSectionCost: number; }; declare class HyperGraphSectionOptimizer2 extends BaseSolver { readonly config: NormalizedHyperGraphSectionOptimizer2Input; readonly rootSolver: HyperGraphSolver; graph: HyperGraph; connections: Connection[]; solvedRoutes: SolvedRoute[]; activeAttempt: SectionSolveAttempt | null; targetRegionAttemptCounts: Map; attemptedSectionCount: number; activeSubSolver: HyperGraphSolver | null; constructor(input: HyperGraphSectionOptimizer2Input); getSolverName(): string; getConstructorParams(): { inputGraph: SerializedHyperGraph; inputConnections: SerializedConnection[]; inputSolvedRoutes: SerializedSolvedRoute[]; sectionExpansionHops: number; maxTargetRegionAttempts: number; maxSectionAttempts: number; minCentralRegionCost: number; ACCEPTABLE_CENTRAL_REGION_COST_START: number | undefined; ACCEPTABLE_CENTRAL_REGION_COST_END: number | undefined; effort: number; }; getOutput(): SolvedRoute[]; _setup(): void; visualize(): GraphicsObject; protected createHyperGraphSolver(input: CreateSectionSolverInput): HyperGraphSolver; getCostOfCentralRegion(region: Region): number; getSectionCost(input: { solvedGraph: SerializedHyperGraph; sectionRegionIds: Set; }): number; _step(): void; private startNextSectionAttempt; private selectTargetRegion; protected getMinCentralRegionCost(): number; private interpolateCentralRegionCost; private createSectionSolveAttempt; private acceptMergedGraph; private rejectActiveAttempt; private clearActiveAttempt; private bumpTargetRegionAttemptCount; private serializeSolvedGraph; private deserializeSolvedRoutes; private getSectionRegionIds; private pruneSectionForBlanking; private getRegionSolutionCost; } type Bounds = { minX: number; minY: number; maxX: number; maxY: number; }; interface JRegion extends Region { d: { bounds: Bounds; center: { x: number; y: number; }; polygon?: { x: number; y: number; }[]; polygonPerimeterCache?: { edgeLengths: number[]; cumulative: number[]; perimeter: number; }; isPad: boolean; isThroughJumper?: boolean; isConnectionRegion?: boolean; isViaRegion?: boolean; }; } interface JPort extends RegionPort { region1T?: number; region2T?: number; d: { x: number; y: number; }; } type JumperGraph = { regions: JRegion[]; ports: JPort[]; jumperLocations?: Array<{ center: { x: number; y: number; }; orientation: "vertical" | "horizontal"; padRegions: JRegion[]; }>; }; /** * Applies a transformation matrix to all points in a graph. * Transforms region bounds, region centers, and port positions. */ declare const applyTransformToGraph: (graph: JumperGraph, matrix: Matrix) => JumperGraph; /** * Rotates a graph 90 degrees clockwise around its center. */ declare const rotateGraph90Degrees: (graph: JumperGraph) => JumperGraph; declare const JUMPER_GRAPH_SOLVER_DEFAULTS: { portUsagePenalty: number; portUsagePenaltySq: number; crossingPenalty: number; crossingPenaltySq: number; ripCost: number; greedyMultiplier: number; }; declare class JumperGraphSolver extends HyperGraphSolver { getSolverName(): string; UNIT_OF_COST: string; portUsagePenalty: number; portUsagePenaltySq: number; crossingPenalty: number; crossingPenaltySq: number; ripCost: number; baseMaxIterations: number; additionalMaxIterationsPerConnection: number; additionalMaxIterationsPerCrossing: number; constructor(input: { inputGraph: HyperGraph | SerializedHyperGraph; inputConnections: (Connection | SerializedConnection)[]; inputSolvedRoutes?: SolvedRoute[]; ripCost?: number; portUsagePenalty?: number; crossingPenalty?: number; baseMaxIterations?: number; additionalMaxIterationsPerConnection?: number; }); private populateDistanceToEndMaps; estimateCostToEnd(port: JPort): number; getPortUsagePenalty(port: JPort): number; isTransitionAllowed(region: JRegion, port1: JPort, port2: JPort): boolean; computeIncreasedRegionCostIfPortsAreUsed(region: JRegion, port1: JPort, port2: JPort): number; getRipsRequiredForPortUsage(region: JRegion, port1: JPort, port2: JPort): RegionPortAssignment[]; isRipRequiredForPortUsage(region: JRegion, _port1: JPort, _port2: JPort): boolean; routeSolvedHook(solvedRoute: SolvedRoute): void; routeStartedHook(connection: Connection): void; visualize(): GraphicsObject; } declare const calculateGraphBounds: (regions: JRegion[]) => Bounds; type XYConnection = { start: { x: number; y: number; }; end: { x: number; y: number; }; connectionId: string; }; type JumperGraphWithConnections = JumperGraph & { connections: Connection[]; }; /** * Creates a new graph from a base graph with additional connection regions at * specified positions on the boundary. Connection regions are 0.4x0.4 pseudo-regions * that contain one port point connecting them to the grid boundary. */ declare const createGraphWithConnectionsFromBaseGraph: (baseGraph: JumperGraph, xyConnections: XYConnection[]) => JumperGraphWithConnections; declare const generateJumperGrid: ({ cols, rows, marginX, marginY, innerColChannelPointCount, innerRowChannelPointCount, outerPaddingX, outerPaddingY, outerChannelXPoints, outerChannelYPoints, orientation, }: { cols: number; rows: number; marginX: number; marginY: number; innerColChannelPointCount?: number; innerRowChannelPointCount?: number; outerPaddingX?: number; outerPaddingY?: number; outerChannelXPoints?: number; outerChannelYPoints?: number; orientation?: "vertical" | "horizontal"; }) => JumperGraph; declare const generateJumperX4Grid: ({ cols, rows, marginX, marginY, innerColChannelPointCount, innerRowChannelPointCount, regionsBetweenPads, outerPaddingX: outerPaddingXParam, outerPaddingY: outerPaddingYParam, outerChannelXPointCount, outerChannelYPointCount, orientation, center, bounds, parallelTracesUnderJumperCount, }: { cols: number; rows: number; marginX: number; marginY: number; innerColChannelPointCount?: number; innerRowChannelPointCount?: number; regionsBetweenPads?: boolean; outerPaddingX?: number; outerPaddingY?: number; outerChannelXPointCount?: number; outerChannelYPointCount?: number; orientation?: "vertical" | "horizontal"; center?: { x: number; y: number; }; bounds?: { minX: number; maxX: number; minY: number; maxY: number; }; /** Number of trace points that can pass through the jumper body from top to bottom without using jumpers */ parallelTracesUnderJumperCount?: number; }) => JumperGraph; type RegionRef = { id: string; }; type PortSpread = { kind: "midpoint"; } | { kind: "even"; inset?: "half" | number; } | { kind: "fractions"; ts: number[]; }; type ConnectOpts = { idPrefix?: string; tolerance?: number; }; type ValidateOpts = { tolerance?: number; allowNonBoundaryPorts?: boolean; }; type BuildOpts = { validate?: boolean; tolerance?: number; }; type SharedBoundary = { axis: "vertical" | "horizontal"; position: number; min: number; max: number; }; type RegionData = { id: string; bounds: Bounds | null; polygon: { x: number; y: number; }[] | null; center: { x: number; y: number; } | null; width: number | null; height: number | null; anchor: "center" | "min"; isPad: boolean; isThroughJumper: boolean; isConnectionRegion: boolean; meta: Record; }; type PortData = { id: string; region1Id: string; region2Id: string; x: number; y: number; }; declare class TopologyError extends Error { details?: { regionIds?: string[]; relationship?: string; suggestion?: string; } | undefined; constructor(message: string, details?: { regionIds?: string[]; relationship?: string; suggestion?: string; } | undefined); } declare class RegionBuilder implements RegionRef { private data; constructor(id: string); get id(): string; rect(b: Bounds): this; polygon(points: { x: number; y: number; }[]): this; center(x: number, y: number): this; size(w: number, h: number, anchor?: "center" | "min"): this; pad(isPad?: boolean): this; throughJumper(isTJ?: boolean): this; connectionRegion(isConn?: boolean): this; meta(extra: Record): this; getData(): RegionData; ref(): RegionRef; } type AddPortFn$1 = (port: PortData) => void; type PrefixIdFn = (id: string) => string; declare class ConnectBuilder { private region1Id; private region2Id; private bounds1; private bounds2; private tolerance; private prefix; private prefixIdFn; private addPortFn; private portIds; private boundary; private prefixWasExplicitlySet; constructor(region1Id: string, region2Id: string, bounds1: Bounds, bounds2: Bounds, addPortFn: AddPortFn$1, prefixIdFn: PrefixIdFn, opts?: { idPrefix?: string; tolerance?: number; }); private ensureBoundary; idPrefix(prefix: string): this; private getFullPrefix; ports(count: number, spread?: PortSpread): this; at(t: number): this; atXY(p: { x: number; y: number; }): this; getPortIds(): string[]; finalizeIfNeeded(): void; hasPortsAdded(): boolean; } type ResolveRegionFn = (ref: RegionRef | string) => { id: string; bounds: Bounds; }; type AddPortFn = (port: PortData) => void; declare class PortBuilder { private portId; private region1Id; private region2Id; private position; private tValue; private resolveRegionFn; private addPortFn; private tolerance; constructor(id: string, resolveRegionFn: ResolveRegionFn, addPortFn: AddPortFn, tolerance?: number); id(id: string): this; between(a: RegionRef | string, b: RegionRef | string): this; onSharedEdge(t?: number): this; at(p: { x: number; y: number; }): this; done(): void; } declare class Topology { private regions; private ports; private portIds; private pendingConnections; private scopePrefix; private defaultTolerance; private prefixId; private generateRegionId; private generatePortId; region(id?: string): RegionBuilder; getRegion(id: string): RegionRef; private resolveRegion; private addPort; connect(a: RegionRef | string, b: RegionRef | string, opts?: ConnectOpts): ConnectBuilder; port(id?: string): PortBuilder; scope(prefix: string, fn: (t: Topology) => void): void; validate(opts?: ValidateOpts): void; toJumperGraph(opts?: BuildOpts): JumperGraph; merge(graph: JumperGraph, opts?: { prefix?: string; transform?: (p: { x: number; y: number; }) => { x: number; y: number; }; }): void; getRegionIds(): string[]; getPortIds(): string[]; } export { type Bounds, type BuildOpts, type Candidate, ConnectBuilder, type ConnectOpts, type Connection, type ConnectionId, type CreateHyperGraphSolver, type CreateHyperGraphSolverInput, type CreateSectionSolverInput, type GScore, type GraphEdgeId, type HyperGraph, type HyperGraphSection, HyperGraphSectionOptimizer, HyperGraphSectionOptimizer2, type HyperGraphSectionOptimizer2Input, HyperGraphSolver, type JPort, type JRegion, JUMPER_GRAPH_SOLVER_DEFAULTS, type JumperGraph, JumperGraphSolver, type JumperGraphWithConnections, type NetworkId, type PortAssignment, PortBuilder, type PortData, type PortId, type PortSpread, type Region, RegionBuilder, type RegionData, type RegionId, type RegionPort, type RegionPortAssignment, type RegionRef, type SectionRoute, type SerializedCandidate, type SerializedConnection, type SerializedGraphPort, type SerializedGraphRegion, type SerializedHyperGraph, type SerializedRegionPortAssignment, type SerializedSectionRouteBinding, type SerializedSolvedRoute, type SharedBoundary, type SolvedRoute, Topology, TopologyError, type ValidateOpts, type XYConnection, applyTransformToGraph, calculateGraphBounds, convertConnectionsToSerializedConnections, convertHyperGraphToSerializedHyperGraph, createBlankHyperGraph, createGraphWithConnectionsFromBaseGraph, extractSectionOfHyperGraph, generateJumperGrid, generateJumperX4Grid, pruneDeadEndPorts, reattachSectionToGraph, rotateGraph90Degrees };