@tscircuit/hypergraph 0.0.27 → 0.0.29

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +172 -56
  2. package/dist/index.js +874 -752
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -625,6 +625,117 @@ declare class Topology {
625
625
  getPortIds(): string[];
626
626
  }
627
627
 
628
+ var Net6 = [
629
+ {
630
+ viaId: "4ef04070-bacf-4a8a-8ac9-ea222cf4bf2c",
631
+ diameter: 0.6,
632
+ position: {
633
+ x: 1.483834,
634
+ y: 0.582296
635
+ }
636
+ },
637
+ {
638
+ viaId: "79364d38-c966-4eff-aa4a-e3ff6cca6339",
639
+ diameter: 0.6,
640
+ position: {
641
+ x: -0.8,
642
+ y: -1.893395
643
+ }
644
+ },
645
+ {
646
+ viaId: "f1d52fd5-ddd2-4440-8772-da3d096b033f",
647
+ diameter: 0.6,
648
+ position: {
649
+ x: -0.703066,
650
+ y: 1.2
651
+ }
652
+ }
653
+ ];
654
+ var Net5 = [
655
+ {
656
+ viaId: "4e57cee8-0910-4c83-9ec1-1ed2c9d16dcc",
657
+ diameter: 0.6,
658
+ position: {
659
+ x: 1.268717,
660
+ y: -1.698536
661
+ }
662
+ },
663
+ {
664
+ viaId: "a3797f13-73f9-48c3-a448-bea3980cdd65",
665
+ diameter: 0.6,
666
+ position: {
667
+ x: -1.115754,
668
+ y: -0.799377
669
+ }
670
+ },
671
+ {
672
+ viaId: "b0c56bb1-ea80-4154-9bb7-cb0fd760de8f",
673
+ diameter: 0.6,
674
+ position: {
675
+ x: 0.397934,
676
+ y: 1.458567
677
+ }
678
+ }
679
+ ];
680
+ var Net7 = [
681
+ {
682
+ viaId: "3719876b-17c8-4ee3-9cce-5b5c073d6614",
683
+ diameter: 0.6,
684
+ position: {
685
+ x: 1.186721,
686
+ y: 1.32508
687
+ }
688
+ },
689
+ {
690
+ viaId: "4e46d759-a04a-4f7e-99cd-9e05adf5fa23",
691
+ diameter: 0.6,
692
+ position: {
693
+ x: -1.275,
694
+ y: 0
695
+ }
696
+ },
697
+ {
698
+ viaId: "63afce65-b94e-47da-ae14-51ff0ee8eb39",
699
+ diameter: 0.6,
700
+ position: {
701
+ x: 1.655408,
702
+ y: -0.998198
703
+ }
704
+ }
705
+ ];
706
+ var Net8 = [
707
+ {
708
+ viaId: "26d3bef1-a78f-4947-b551-c48f04289a98",
709
+ diameter: 0.6,
710
+ position: {
711
+ x: 1.553029,
712
+ y: -0.164505
713
+ }
714
+ },
715
+ {
716
+ viaId: "548acbca-8b68-4186-a589-681ec44fba42",
717
+ diameter: 0.6,
718
+ position: {
719
+ x: 0.222457,
720
+ y: -1.866711
721
+ }
722
+ },
723
+ {
724
+ viaId: "d6bf60bf-4b90-4967-a295-fc930b1f2549",
725
+ diameter: 0.6,
726
+ position: {
727
+ x: -1.419706,
728
+ y: 0.868747
729
+ }
730
+ }
731
+ ];
732
+ var viasByNet = {
733
+ Net6: Net6,
734
+ Net5: Net5,
735
+ Net7: Net7,
736
+ Net8: Net8
737
+ };
738
+
628
739
  declare const VIA_GRAPH_SOLVER_DEFAULTS: {
629
740
  portUsagePenalty: number;
630
741
  portUsagePenaltySq: number;
@@ -633,7 +744,7 @@ declare const VIA_GRAPH_SOLVER_DEFAULTS: {
633
744
  ripCost: number;
634
745
  greedyMultiplier: number;
635
746
  };
636
- type ViaData$1 = {
747
+ type ViaData = {
637
748
  viaId: string;
638
749
  diameter: number;
639
750
  position: {
@@ -641,11 +752,11 @@ type ViaData$1 = {
641
752
  y: number;
642
753
  };
643
754
  };
644
- type ViasByNet$1 = Record<string, ViaData$1[]>;
755
+ type ViasByNet = Record<string, ViaData[]>;
645
756
  declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
646
757
  getSolverName(): string;
647
758
  UNIT_OF_COST: string;
648
- viasByNet?: ViasByNet$1;
759
+ viasByNet?: ViasByNet;
649
760
  portUsagePenalty: number;
650
761
  portUsagePenaltySq: number;
651
762
  crossingPenalty: number;
@@ -657,7 +768,7 @@ declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
657
768
  constructor(input: {
658
769
  inputGraph: HyperGraph | SerializedHyperGraph;
659
770
  inputConnections: (Connection | SerializedConnection)[];
660
- viasByNet?: ViasByNet$1;
771
+ viasByNet?: ViasByNet;
661
772
  ripCost?: number;
662
773
  portUsagePenalty?: number;
663
774
  crossingPenalty?: number;
@@ -674,46 +785,6 @@ declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
674
785
  visualize(): GraphicsObject;
675
786
  }
676
787
 
677
- type ViaGraphFromXYConnectionsResult = JumperGraph & {
678
- connections: Connection[];
679
- tiledViasByNet: ViasByNet$1;
680
- tileCount: {
681
- rows: number;
682
- cols: number;
683
- };
684
- };
685
- /**
686
- * Creates a complete via topology graph from XY connections.
687
- *
688
- * This is the main entry point for integrating ViaGraphSolver with dataset02.
689
- * It:
690
- * 1. Calculates bounds from connection XY coordinates (no margin)
691
- * 2. Generates a tiled grid of via topologies that fits within bounds
692
- * 3. Creates outer frame regions to fill remaining space
693
- * 4. Attaches connection regions to the graph
694
- *
695
- * @param xyConnections - Array of connections with start/end XY coordinates
696
- * @param viasByNet - Via positions grouped by net name
697
- * @param opts - Optional configuration (tileSize defaults to 5mm, portPitch to 0.4mm)
698
- */
699
- declare function createViaGraphFromXYConnections(xyConnections: XYConnection[], viasByNet: ViasByNet$1, opts?: {
700
- tileSize?: number;
701
- portPitch?: number;
702
- }): ViaGraphFromXYConnectionsResult;
703
-
704
- type ViaGraphWithConnections = JumperGraph & {
705
- connections: Connection[];
706
- };
707
- /**
708
- * Creates a new graph from a via topology base graph with additional connection
709
- * regions at specified positions on the boundary.
710
- *
711
- * Uses polygon-edge proximity (not bounding-box proximity) to find the correct
712
- * boundary region for each connection endpoint. This is necessary because the
713
- * via topology's polygon regions have overlapping bounding boxes.
714
- */
715
- declare const createViaGraphWithConnections: (baseGraph: JumperGraph, xyConnections: XYConnection[]) => ViaGraphWithConnections;
716
-
717
788
  type Bounds = {
718
789
  minX: number;
719
790
  maxX: number;
@@ -730,29 +801,20 @@ type Bounds = {
730
801
  * space between the tiled area and the problem bounds.
731
802
  */
732
803
  declare function generateViaTopologyGrid(opts: {
733
- viasByNet: ViasByNet$1;
804
+ viasByNet: ViasByNet;
734
805
  bounds: Bounds;
735
806
  tileSize?: number;
736
807
  portPitch?: number;
737
808
  }): {
738
809
  regions: JRegion[];
739
810
  ports: JPort[];
740
- tiledViasByNet: ViasByNet$1;
811
+ tiledViasByNet: ViasByNet;
741
812
  tileCount: {
742
813
  rows: number;
743
814
  cols: number;
744
815
  };
745
816
  };
746
817
 
747
- type ViaData = {
748
- viaId: string;
749
- diameter: number;
750
- position: {
751
- x: number;
752
- y: number;
753
- };
754
- };
755
- type ViasByNet = Record<string, ViaData[]>;
756
818
  /**
757
819
  * Generates four outer topology regions (top, bottom, left, right) that wrap
758
820
  * around all vias, forming a closed frame that extends to the graph boundary.
@@ -769,4 +831,58 @@ declare const generateViaTopologyRegions: (viasByNet: ViasByNet, opts?: {
769
831
  ports: JPort[];
770
832
  };
771
833
 
772
- export { type Bounds$1 as Bounds, type BuildOpts, type Candidate, ConnectBuilder, type ConnectOpts, type Connection, type ConnectionId, type GScore, type GraphEdgeId, type HyperGraph, 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 SerializedConnection, type SerializedGraphPort, type SerializedGraphRegion, type SerializedHyperGraph, type SerializedRegionPortAssignment, type SharedBoundary, type SolvedRoute, Topology, TopologyError, VIA_GRAPH_SOLVER_DEFAULTS, type ValidateOpts, type ViaData$1 as ViaData, type ViaGraphFromXYConnectionsResult, ViaGraphSolver, type ViaGraphWithConnections, type ViasByNet$1 as ViasByNet, type XYConnection, applyTransformToGraph, calculateGraphBounds, convertConnectionsToSerializedConnections, convertHyperGraphToSerializedHyperGraph, createGraphWithConnectionsFromBaseGraph, createViaGraphFromXYConnections, createViaGraphWithConnections, generateJumperGrid, generateJumperX4Grid, generateViaTopologyGrid, generateViaTopologyRegions, rotateGraph90Degrees };
834
+ declare function generateDefaultViaTopologyRegions(opts: Parameters<typeof generateViaTopologyRegions>[1]): {
835
+ regions: JRegion[];
836
+ ports: JPort[];
837
+ };
838
+ declare function generateDefaultViaTopologyGrid(opts: Omit<Parameters<typeof generateViaTopologyGrid>[0], "viasByNet">): {
839
+ regions: JRegion[];
840
+ ports: JPort[];
841
+ tiledViasByNet: ViasByNet;
842
+ tileCount: {
843
+ rows: number;
844
+ cols: number;
845
+ };
846
+ };
847
+
848
+ type ViaGraphFromXYConnectionsResult = JumperGraph & {
849
+ connections: Connection[];
850
+ tiledViasByNet: ViasByNet;
851
+ tileCount: {
852
+ rows: number;
853
+ cols: number;
854
+ };
855
+ };
856
+ /**
857
+ * Creates a complete via topology graph from XY connections.
858
+ *
859
+ * This is the main entry point for integrating ViaGraphSolver with dataset02.
860
+ * It:
861
+ * 1. Calculates bounds from connection XY coordinates (no margin)
862
+ * 2. Generates a tiled grid of via topologies that fits within bounds
863
+ * 3. Creates outer frame regions to fill remaining space
864
+ * 4. Attaches connection regions to the graph
865
+ *
866
+ * @param xyConnections - Array of connections with start/end XY coordinates
867
+ * @param viasByNet - Via positions grouped by net name
868
+ * @param opts - Optional configuration (tileSize defaults to 5mm, portPitch to 0.4mm)
869
+ */
870
+ declare function createViaGraphFromXYConnections(xyConnections: XYConnection[], viasByNet: ViasByNet, opts?: {
871
+ tileSize?: number;
872
+ portPitch?: number;
873
+ }): ViaGraphFromXYConnectionsResult;
874
+
875
+ type ViaGraphWithConnections = JumperGraph & {
876
+ connections: Connection[];
877
+ };
878
+ /**
879
+ * Creates a new graph from a via topology base graph with additional connection
880
+ * regions at specified positions on the boundary.
881
+ *
882
+ * Uses polygon-edge proximity (not bounding-box proximity) to find the correct
883
+ * boundary region for each connection endpoint. This is necessary because the
884
+ * via topology's polygon regions have overlapping bounding boxes.
885
+ */
886
+ declare const createViaGraphWithConnections: (baseGraph: JumperGraph, xyConnections: XYConnection[]) => ViaGraphWithConnections;
887
+
888
+ export { type Bounds$1 as Bounds, type BuildOpts, type Candidate, ConnectBuilder, type ConnectOpts, type Connection, type ConnectionId, type GScore, type GraphEdgeId, type HyperGraph, 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 SerializedConnection, type SerializedGraphPort, type SerializedGraphRegion, type SerializedHyperGraph, type SerializedRegionPortAssignment, type SharedBoundary, type SolvedRoute, Topology, TopologyError, VIA_GRAPH_SOLVER_DEFAULTS, type ValidateOpts, type ViaData, type ViaGraphFromXYConnectionsResult, ViaGraphSolver, type ViaGraphWithConnections, type ViasByNet, type XYConnection, applyTransformToGraph, calculateGraphBounds, convertConnectionsToSerializedConnections, convertHyperGraphToSerializedHyperGraph, createGraphWithConnectionsFromBaseGraph, createViaGraphFromXYConnections, createViaGraphWithConnections, generateDefaultViaTopologyGrid, generateDefaultViaTopologyRegions, generateJumperGrid, generateJumperX4Grid, generateViaTopologyGrid, generateViaTopologyRegions, rotateGraph90Degrees, viasByNet };