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 (zone_id, 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 (zone_id, 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/arch/path.py
132 133 134 135 136 137 138 139 140 141 142 143 144 | |
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/arch/path.py
146 147 148 149 150 | |
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/arch/path.py
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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
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/arch/path.py
165 166 167 168 169 | |
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/arch/path.py
152 153 154 155 156 157 158 159 160 161 162 163 | |