

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_lowerCAmelCase :	List[Any]     				=    {
    'configuration_videomae': ['VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VideoMAEConfig'],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _lowerCAmelCase :	Dict     				=    [
         'VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST',
         'VideoMAEForPreTraining',
         'VideoMAEModel',
         'VideoMAEPreTrainedModel',
         'VideoMAEForVideoClassification',
     ]

try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _lowerCAmelCase :	Dict     				=    ['VideoMAEFeatureExtractor']
     _lowerCAmelCase :	Any     				=    ['VideoMAEImageProcessor']

if TYPE_CHECKING:
     from .configuration_videomae import VIDEOMAE_PRETRAINED_CONFIG_ARCHIVE_MAP, VideoMAEConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_videomae import (
              VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST,
              VideoMAEForPreTraining,
              VideoMAEForVideoClassification,
              VideoMAEModel,
              VideoMAEPreTrainedModel,
          )

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .feature_extraction_videomae import VideoMAEFeatureExtractor
          from .image_processing_videomae import VideoMAEImageProcessor

else:
     import sys

     _lowerCAmelCase :	List[Any]     				=    _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)







from __future__ import annotations


class     lowerCAmelCase				:


       '''simple docstring'''







       def __init__(	self					:  Dict						,	__snake_case					:  int     )   -> None:







        '''simple docstring'''

        lowerCamelCase      						=    vertices
        lowerCamelCase      						=    [[0] * vertices for _ in range(__snake_case     )]

       def   lowerCamelCase__						(	self					:  List[str]						,	__snake_case					:  list[int]     )   -> None:







        '''simple docstring'''

        print('Vertex \t Distance from Source'     )
        for vertex in range(self.vertices     ):
         print(__snake_case						,	'\t\t'						,	distances_from_source[vertex]     )

       def   lowerCamelCase__						(	self					:  Optional[int]						,	__snake_case					:  list[int]						,	__snake_case					:  list[bool]     )   -> int:







        '''simple docstring'''

        lowerCamelCase      						=    1e7
        lowerCamelCase      						=    0

        # Search not nearest vertex not in the shortest path tree
        for vertex in range(self.vertices     ):
         if distances_from_source[vertex] < minimum and visited[vertex] is False:
          lowerCamelCase      						=    distances_from_source[vertex]
          lowerCamelCase      						=    vertex
        return min_index





       def   lowerCamelCase__						(	self					:  Optional[Any]						,	__snake_case					:  int     )   -> None:







        '''simple docstring'''

        lowerCamelCase      						=    [int(1e7     )] * self.vertices  # distances from the source
        lowerCamelCase      						=    0
        lowerCamelCase      						=    [False] * self.vertices

        for _ in range(self.vertices     ):
         lowerCamelCase      						=    self.minimum_distance(__snake_case						,	__snake_case     )
         lowerCamelCase      						=    True

         # Update dist value of the adjacent vertices
         # of the picked vertex only if the current
         # distance is greater than new distance and
         # the vertex in not in the shortest path tree
         for v in range(self.vertices     ):
          if (
              self.graph[u][v] > 0
              and visited[v] is False
              and distances[v] > distances[u] + self.graph[u][v]
          ):
           lowerCamelCase      						=    distances[u] + self.graph[u][v]

        self.print_solution(__snake_case     )


if __name__ == "__main__":
     _lowerCAmelCase :	Dict     				=    Graph(9)
     _lowerCAmelCase :	int     				=    [
         [0, 4, 0, 0, 0, 0, 0, 8, 0],
         [4, 0, 8, 0, 0, 0, 0, 1_1, 0],
         [0, 8, 0, 7, 0, 4, 0, 0, 2],
         [0, 0, 7, 0, 9, 1_4, 0, 0, 0],
         [0, 0, 0, 9, 0, 1_0, 0, 0, 0],
         [0, 0, 4, 1_4, 1_0, 0, 2, 0, 0],
         [0, 0, 0, 0, 0, 2, 0, 1, 6],
         [8, 1_1, 0, 0, 0, 0, 1, 0, 7],
         [0, 0, 2, 0, 0, 0, 6, 7, 0],
     ]
     graph.dijkstra(0)




