

from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass






@dataclass
class      lowerCamelCase_      :
	_lowercase		:   int
	_lowercase		:   int






class      lowerCamelCase_      :




	def __init__(     self						:     Tuple					,      __A						:     int							):
		__A :			list[list[Edge]]		    =			[[] for _ in range(__A							)]
		__A :			Optional[int]		    =			size




	def __getitem__(     self						:     Optional[Any]					,      __A						:     int							):
		return iter(self._graph[vertex]							)




	@property
	def        lowerCAmelCase_       (     self						:     Optional[int]							):
		return self._size




	def        lowerCAmelCase_       (     self						:     Optional[Any]					,      __A						:     int					,      __A						:     int					,      __A						:     int							):
		if weight not in (0, 1):
			raise ValueError("""Edge weight must be either 0 or 1."""							)

		if to_vertex < 0 or to_vertex >= self.size:
			raise ValueError("""Vertex indexes must be in [0; size)."""							)

		self._graph[from_vertex].append(Edge(__A					,      __A							)							)




	def        lowerCAmelCase_       (     self						:     Optional[int]					,      __A						:     int					,      __A						:     int							):
		__A :			Any		    =			deque([start_vertex]							)
		__A :			list[int | None]		    =			[None] * self.size
		__A :			Any		    =			0

		while queue:
			__A :			Dict		    =			queue.popleft()
			__A :			int		    =			distances[current_vertex]
			if current_distance is None:
				continue

			for edge in self[current_vertex]:
				__A :			Union[str, Any]		    =			current_distance + edge.weight
				__A :			int		    =			distances[edge.destination_vertex]
				if (
				    isinstance(__A					,      __A							)
				    and new_distance >= dest_vertex_distance
				):
					continue
				__A :			str		    =			new_distance
				if edge.weight == 0:
					queue.appendleft(edge.destination_vertex							)
				else:
					queue.append(edge.destination_vertex							)

		if distances[finish_vertex] is None:
			raise ValueError("""No path from start_vertex to finish_vertex."""							)

		return distances[finish_vertex]


if __name__ == "__main__":
			import doctest

			doctest.testmod()









'''simple docstring'''
def       a_				(	UpperCamelCase_ ):

							if length <= 0 or not isinstance(UpperCamelCase_						,  UpperCamelCase_ ):
														raise ValueError("Length must be a positive integer." )
							return [n * (2 * n - 1) for n in range(UpperCamelCase_ )]


if __name__ == "__main__":
							print(hexagonal_numbers(length=5))
							print(hexagonal_numbers(length=10))





