






'''simple docstring'''

from __future__ import annotations

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







@dataclass
class 	SCREAMING_SNAKE_CASE	:
       snake_case__    :     int
       snake_case__    :     int







class 	SCREAMING_SNAKE_CASE	:




       def __init__(					self      : Dict	,    A__      : int					):


            """simple docstring"""







            __lowerCamelCase						:       list[list[Edge]]				   =				[[] for _ in range(A__					)]
            __lowerCamelCase						:       Optional[int]				   =				size




       def __getitem__(					self      : Tuple	,    A__      : int					):


            """simple docstring"""







            return iter(self._graph[vertex]					)




       @property
       def 					a_					(					self      : Any					):


            """simple docstring"""







            return self._size




       def 					a_					(					self      : int	,    A__      : int	,    A__      : int	,    A__      : int					):


            """simple docstring"""







            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 					a_					(					self      : str	,    A__      : int	,    A__      : int					):


            """simple docstring"""







            __lowerCamelCase						:       List[str]				   =				deque([start_vertex]					)
            __lowerCamelCase						:       list[int | None]				   =				[None] * self.size
            __lowerCamelCase						:       Union[str, Any]				   =				0

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

                 for edge in self[current_vertex]:
                      __lowerCamelCase						:       int				   =				current_distance + edge.weight
                      __lowerCamelCase						:       Dict				   =				distances[edge.destination_vertex]
                      if (
                          isinstance(A__	,    A__					)
                          and new_distance >= dest_vertex_distance
                      ):
                           continue
                      __lowerCamelCase						:       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'''

from __future__ import annotations

import typing
from collections.abc import Iterable

import numpy as np

UpperCAmelCase__						:List[str]          =			typing.Union[Iterable[float], Iterable[int], np.ndarray]  # noqa: UP007
UpperCAmelCase__						:Optional[int]          =			typing.Union[np.floataa, int, float]  # noqa: UP007
def     __lowercase  (_lowercase,						_lowercase     )   ->     VectorOut:


     """simple docstring"""
     return np.sqrt(np.sum((np.asarray(_lowercase     ) - np.asarray(_lowercase     )) ** 2     )     )
def     __lowercase  (_lowercase,						_lowercase     )   ->     VectorOut:


     """simple docstring"""
     return sum((va - va) ** 2 for va, va in zip(_lowercase,						_lowercase     )     ) ** (1 / 2)


if __name__ == "__main__":
   def     __lowercase  ()   ->     None:


        """simple docstring"""
        from timeit import timeit

        print("""Without Numpy"""     )
        print(
            timeit(
                """euclidean_distance_no_np([1, 2, 3], [4, 5, 6])""",						number=10_000,						globals=globals(),						)     )
        print("""With Numpy"""     )
        print(
            timeit(
                """euclidean_distance([1, 2, 3], [4, 5, 6])""",						number=10_000,						globals=globals(),						)     )
   benchmark()



