



from __future__ import annotations





class 		UpperCAmelCase    :





   def __init__(						self							,  _lowerCAmelCase      ):
         _lowerCAmelCase			      =	vertices
         _lowerCAmelCase			      =	[[0] * vertices for _ in range(_lowerCAmelCase      )]





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





   def 						__lowerCAmelCase				(						self							,  _lowerCAmelCase							,  _lowerCAmelCase      ):
         _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							,  _lowerCAmelCase      ):
         _lowerCAmelCase			      =	[int(1E7      )] * self.vertices  # distances from the source
         _lowerCAmelCase			      =	0
         _lowerCAmelCase			      =	[False] * self.vertices

         for _ in range(self.vertices      ):
               _lowerCAmelCase			      =	self.minimum_distance(_lowerCAmelCase							,  _lowerCAmelCase      )
               _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(_lowerCAmelCase      )


if __name__ == "__main__":
    UpperCAmelCase_          =				Graph(9)
    UpperCAmelCase_          =				[
        [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)




def 						_lowerCAmelCase    (					__lowerCamelCase :  int  ):



 """simple docstring"""





 if not isinstance(__lowerCamelCase		,						__lowerCamelCase  ):
  __SCREAMING_SNAKE_CASE							:     Union[str, Any]							=						(
      "operation can not be conducted on a object of type "
      F"""{type(__lowerCamelCase  ).__name__}"""
  )
  raise TypeError(__lowerCamelCase  )
 __SCREAMING_SNAKE_CASE							:     List[str]							=						""
 for _ in range(0		,						32  ):
  bit_string += str(number % 2  )
  __SCREAMING_SNAKE_CASE							:     Union[str, Any]							=						number >> 1
 return bit_string






def 						_lowerCAmelCase    (					__lowerCamelCase :  int  ):



 """simple docstring"""





 if number < 0:
  raise ValueError("the value of input must be positive"  )
 elif isinstance(__lowerCamelCase		,						__lowerCamelCase  ):
  raise TypeError("Input value must be a 'int' type"  )
 elif isinstance(__lowerCamelCase		,						__lowerCamelCase  ):
  raise TypeError("'<' not supported between instances of 'str' and 'int'"  )
 __SCREAMING_SNAKE_CASE							:     Any							=						0
 # iterator over [1 to 32],since we are dealing with 32 bit integer
 for _ in range(1		,						33  ):
  # left shift the bits by unity
  __SCREAMING_SNAKE_CASE							:     Optional[int]							=						result << 1
  # get the end bit
  __SCREAMING_SNAKE_CASE							:     Union[str, Any]							=						number % 2
  # right shift the bits by unity
  __SCREAMING_SNAKE_CASE							:     Optional[Any]							=						number >> 1
  # add that bit to our ans
  __SCREAMING_SNAKE_CASE							:     Optional[int]							=						result | end_bit
 return get_reverse_bit_string(__lowerCamelCase  )


if __name__ == "__main__":
      import doctest

      doctest.testmod()






