import math




class 	__snake_case	:





      '''simple docstring'''






      def __init__(					self     :				Union[str, Any]    ,  _UpperCamelCase     :				Any=0)				->str:  # a graph with Node 0,1,...,N-1


          """simple docstring"""


          _lowerCamelCase     :		Optional[Any] 						=						n
          _lowerCamelCase     :		Tuple 						=						[
              [math.inf for j in range(0    ,  _UpperCamelCase)] for i in range(0    ,  _UpperCamelCase)
          ]  # adjacency matrix for weight
          _lowerCamelCase     :		List[Any] 						=						[
              [math.inf for j in range(0    ,  _UpperCamelCase)] for i in range(0    ,  _UpperCamelCase)
          ]  # dp[i][j] stores minimum distance from i to j



      def 	_SCREAMING_SNAKE_CASE    (					self     :				Optional[Any]    ,  _UpperCamelCase     :				List[str]    ,  _UpperCamelCase     :				Any    ,  _UpperCamelCase     :				Optional[Any])				->List[str]:


          """simple docstring"""


          _lowerCamelCase     :		List[Any] 						=						w



      def 	_SCREAMING_SNAKE_CASE    (					self     :				List[Any])				->int:


          """simple docstring"""


          for k in range(0    ,  self.n):
              for i in range(0    ,  self.n):
                  for j in range(0    ,  self.n):
                      _lowerCamelCase     :		Tuple 						=						min(self.dp[i][j]    ,  self.dp[i][k] + self.dp[k][j])




      def 	_SCREAMING_SNAKE_CASE    (					self     :				List[str]    ,  _UpperCamelCase     :				List[Any]    ,  _UpperCamelCase     :				Union[str, Any])				->Optional[int]:


          """simple docstring"""


          return self.dp[u][v]


if __name__ == "__main__":
    lowerCAmelCase			:							Dict     =Graph(5)
    graph.add_edge(0, 2, 9)
    graph.add_edge(0, 4, 10)
    graph.add_edge(1, 3, 5)
    graph.add_edge(2, 3, 7)
    graph.add_edge(3, 0, 10)
    graph.add_edge(3, 1, 2)
    graph.add_edge(3, 2, 1)
    graph.add_edge(3, 4, 6)
    graph.add_edge(4, 1, 3)
    graph.add_edge(4, 2, 4)
    graph.add_edge(4, 3, 9)
    graph.floyd_warshall()
    graph.show_min(1, 4)
    graph.show_min(0, 3)





from typing import Optional

from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader




class 	__snake_case	( __lowerCAmelCase		):





      '''simple docstring'''






      def __init__(					self     :				Dict    ,  _UpperCamelCase     :				NestedDataStructureLike[PathLike]    ,  _UpperCamelCase     :				Optional[NamedSplit] = None    ,  _UpperCamelCase     :				Optional[Features] = None    ,  _UpperCamelCase     :				str = None    ,  _UpperCamelCase     :				bool = False    ,  _UpperCamelCase     :				bool = False    ,  _UpperCamelCase     :				Optional[int] = None    ,  **_UpperCamelCase     :				Tuple    ,  )				->Union[str, Any]:


          """simple docstring"""


          super().__init__(
              _UpperCamelCase    ,  split=_UpperCamelCase    ,  features=_UpperCamelCase    ,  cache_dir=_UpperCamelCase    ,  keep_in_memory=_UpperCamelCase    ,  streaming=_UpperCamelCase    ,  num_proc=_UpperCamelCase    ,  **_UpperCamelCase    ,  )
          _lowerCamelCase     :		List[Any] 						=						path_or_paths if isinstance(_UpperCamelCase    ,  _UpperCamelCase) else {self.split: path_or_paths}
          _lowerCamelCase     :		Any 						=						Text(
              cache_dir=_UpperCamelCase    ,  data_files=_UpperCamelCase    ,  features=_UpperCamelCase    ,  **_UpperCamelCase    ,  )




      def 	_SCREAMING_SNAKE_CASE    (					self     :				Optional[Any])				->Optional[Any]:


          """simple docstring"""


          if self.streaming:
              _lowerCamelCase     :		Tuple 						=						self.builder.as_streaming_dataset(split=self.split)
          # Build regular (map-style) dataset
          else:
              _lowerCamelCase     :		List[Any] 						=						None
              _lowerCamelCase     :		Any 						=						None
              _lowerCamelCase     :		List[str] 						=						None
              _lowerCamelCase     :		Dict 						=						None

              self.builder.download_and_prepare(
                  download_config=_UpperCamelCase    ,  download_mode=_UpperCamelCase    ,  verification_mode=_UpperCamelCase    ,  base_path=_UpperCamelCase    ,  num_proc=self.num_proc    ,  )
              _lowerCamelCase     :		Optional[int] 						=						self.builder.as_dataset(
                  split=self.split    ,  verification_mode=_UpperCamelCase    ,  in_memory=self.keep_in_memory)
          return dataset




