code: 
  
  
  import heapq
  
  
  
  
  def       a__						(		snake_case__				:       Tuple	,      snake_case__				:       List[str]	,      snake_case__				:       List[str]    ):
    _UpperCAmelCase		:       Any       =    [(0, start)]  # cost from start node,end node
    _UpperCAmelCase		:       str       =    set()
    while heap:
      ((_UpperCAmelCase),(_UpperCAmelCase))		:       Optional[int]       =    heapq.heappop(snake_case__    )
      if u in visited:
        continue
      visited.add(snake_case__    )
      if u == end:
        return cost
      for v, c in graph[u]:
        if v in visited:
          continue
        _UpperCAmelCase		:       List[str]       =    cost + c
        heapq.heappush(snake_case__	,      (next_item, v)    )
    return -1
  
  
  SCREAMING_SNAKE_CASE__				:    Dict         =    {
      'A': [['B', 2], ['C', 5]],
      'B': [['A', 2], ['D', 3], ['E', 1], ['F', 1]],
      'C': [['A', 5], ['F', 3]],
      'D': [['B', 3]],
      'E': [['B', 4], ['F', 3]],
      'F': [['C', 3], ['E', 3]],
  }
  SCREAMING_SNAKE_CASE__				:    Optional[int]         =    {
      'B': [['C', 1]],
      'C': [['D', 1]],
      'D': [['F', 1]],
      'E': [['B', 1], ['F', 3]],
      'F': [],
  }
  SCREAMING_SNAKE_CASE__				:    Union[str, Any]         =    {
      'B': [['C', 1]],
      'C': [['D', 1]],
      'D': [['F', 1]],
      'E': [['B', 1], ['G', 2]],
      'F': [],
      'G': [['F', 1]],
  }
  
  SCREAMING_SNAKE_CASE__				:    List[Any]         =    dijkstra(G, 'E', 'C')
  print(short_distance)  # E -- 3 --> F -- 3 --> C == 6
  
  SCREAMING_SNAKE_CASE__				:    List[Any]         =    dijkstra(Ga, 'E', 'F')
  print(short_distance)  # E -- 3 --> F == 3
  
  SCREAMING_SNAKE_CASE__				:    Dict         =    dijkstra(Ga, 'E', 'F')
  print(short_distance)  # E -- 2 --> G -- 1 --> F == 3
  
  if __name__ == "__main__":
   import doctest
  
   doctest.testmod()
  
  
  
  
  
  
style_context: 
  
  
  from typing import Any
  
  
  class 		_SCREAMING_SNAKE_CASE    :
  
  
       def __init__(     self						):
         _UpperCAmelCase		:       Union[str, Any]       =    []
         _UpperCAmelCase		:       Dict       =    0
  
  
       def __str__(     self						):
         _UpperCAmelCase		:       Union[str, Any]       =    """<""" + str(self.stack						)[1:-1] + """>"""
         return printed
  
  
       def 					__snake_case(     self       ,				A_						):
         self.stack.append(A_						)
         _UpperCAmelCase		:       Optional[Any]       =    self.length + 1
  
  
       def 					__snake_case(     self						):
         self.rotate(1						)
         _UpperCAmelCase		:       List[Any]       =    self.stack[self.length - 1]
         _UpperCAmelCase		:       Optional[Any]       =    self.stack[:-1]
         self.rotate(self.length - 1						)
         _UpperCAmelCase		:       Union[str, Any]       =    self.length - 1
         return dequeued
  
  
       def 					__snake_case(     self       ,				A_						):
         for _ in range(A_						):
           _UpperCAmelCase		:       Dict       =    self.stack[0]
           _UpperCAmelCase		:       List[Any]       =    self.stack[1:]
           self.put(A_						)
           _UpperCAmelCase		:       Dict       =    self.length - 1
  
  
       def 					__snake_case(     self						):
         _UpperCAmelCase		:       Tuple       =    self.get()
         self.put(A_						)
         self.rotate(self.length - 1						)
         return front
  
  
       def 					__snake_case(     self						):
         return self.length
  
  
  
  
  
  