Path
PathFinder
dataclass
PathFinder(spec: ArchSpec)
physical_address_map
class-attribute
instance-attribute
physical_address_map: dict[LocationAddress, int] = field(
init=False, default_factory=dict
)
Map from (word_id, site_id) tuple to graph node index.
physical_addresses
class-attribute
instance-attribute
physical_addresses: list[LocationAddress] = field(
init=False, default_factory=list
)
Map from graph node index to (word_id, site_id) tuple.
site_graph
class-attribute
instance-attribute
site_graph: PyDiGraph = field(
init=False, default_factory=PyDiGraph
)
Graph representing all sites and edges as lanes.
extract_lanes_from_path
extract_lanes_from_path(
path: list[int],
) -> tuple[LaneAddress, ...]
Given a path as node indices, extract the lane addresses.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/layout/path.py
96 97 98 99 100 101 102 103 104 105 106 107 108 | |
extract_locations_from_path
extract_locations_from_path(
path: list[int],
) -> tuple[LocationAddress, ...]
Given a path as node indices, extract the location addresses.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/layout/path.py
110 111 112 113 114 | |
find_path
find_path(
start: LocationAddress,
end: LocationAddress,
occupied: frozenset[LocationAddress] = frozenset(),
path_heuristic: Callable[
[
tuple[LaneAddress, ...],
tuple[LocationAddress, ...],
],
float,
] = lambda _, __: 0.0,
edge_weight: (
Callable[[LaneAddress], float] | None
) = None,
) -> (
tuple[
tuple[LaneAddress, ...], tuple[LocationAddress, ...]
]
| None
)
Find a weighted shortest path from start to end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
LocationAddress
|
The starting location. |
required |
end
|
LocationAddress
|
The ending location. |
required |
occupied
|
frozenset[LocationAddress]
|
Locations to exclude when searching for a path. If this excludes
|
frozenset()
|
path_heuristic
|
Callable[[tuple[LaneAddress, ...], tuple[LocationAddress, ...]], float]
|
A tie-breaker over candidate shortest paths, evaluated on the candidate location sequence. |
lambda _, __: 0.0
|
edge_weight
|
Callable[[LaneAddress], float] | None
|
Optional edge weight function used for shortest-path costs.
Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[LaneAddress, ...], tuple[LocationAddress, ...]] | None
|
A tuple containing:
- The selected path as |
tuple[tuple[LaneAddress, ...], tuple[LocationAddress, ...]] | None
|
Returns |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/layout/path.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
get_endpoints
get_endpoints(lane: LaneAddress)
Get the start and end LocationAddress for a given LaneAddress.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/layout/path.py
127 128 129 130 131 | |
get_lane
get_lane(
start: LocationAddress, end: LocationAddress
) -> LaneAddress | None
Get the LaneAddress connecting two LocationAddress sites.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/layout/path.py
116 117 118 119 120 121 122 123 124 125 | |