code: 
  """simple docstring"""
  
  
  
  
  
  import heapq
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     UpperCAmelCase_      :      Union[str, Any]      =					[(0, start)]  # cost from start node,end node
     UpperCAmelCase_      :      Optional[Any]      =					set()
     while heap:
        ((UpperCAmelCase_)  ,     (UpperCAmelCase_))      :      Union[str, Any]      =					heapq.heappop(__lowerCamelCase						)
        if u in visited:
           continue
        visited.add(__lowerCamelCase						)
        if u == end:
           return cost
        for v, c in graph[u]:
           if v in visited:
              continue
           UpperCAmelCase_      :      List[Any]      =					cost + c
           heapq.heappush(__lowerCamelCase,	(next_item, v)						)
     return -1
  
  
  _a	 =							{
      '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]],
  }
  _a	 =							{
      'B': [['C', 1]],
      'C': [['D', 1]],
      'D': [['F', 1]],
      'E': [['B', 1], ['F', 3]],
      'F': [],
  }
  _a	 =							{
      'B': [['C', 1]],
      'C': [['D', 1]],
      'D': [['F', 1]],
      'E': [['B', 1], ['G', 2]],
      'F': [],
      'G': [['F', 1]],
  }
  
  _a	 =							dijkstra(G, 'E', 'C')
  print(short_distance)  # E -- 3 --> F -- 3 --> C == 6
  
  _a	 =							dijkstra(Ga, 'E', 'F')
  print(short_distance)  # E -- 3 --> F == 3
  
  _a	 =							dijkstra(Ga, 'E', 'F')
  print(short_distance)  # E -- 2 --> G -- 1 --> F == 3
  
  if __name__ == "__main__":
      import doctest
  
      doctest.testmod()
  
  
  
style_context: 
  """simple docstring"""
  
  
  
  
  
  from __future__ import annotations
  
  from typing import Any
  
  
  class A_			:
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    def __init__(	self       ,     lowercase_       ,     lowercase_						):  # noqa: A002
  
       """simple docstring"""
       UpperCAmelCase_      :      Optional[Any]      =					item
       UpperCAmelCase_      :      Optional[Any]      =					next
  
  
  
  
  class A_			:
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    def __init__(	self						):
  
       """simple docstring"""
       UpperCAmelCase_      :      Node | None      =					None
       UpperCAmelCase_      :      Optional[int]      =					0
  
  
  
  
  
  
  
    def  UpperCamelCase__      (	self       ,     lowercase_						):
  
       """simple docstring"""
       UpperCAmelCase_      :      int      =					Node(lowercase_       ,     self.head						)
       self.size += 1
  
  
  
  
  
  
  
    def  UpperCamelCase__      (	self						):
  
       """simple docstring"""
       # Switched 'self.is_empty()' to 'self.head is None'
       # because mypy was considering the possibility that 'self.head'
       # can be None in below else part and giving error
       if self.head is None:
          return None
       else:
          UpperCAmelCase_      :      int      =					self.head.item
          UpperCAmelCase_      :      str      =					self.head.next
          self.size -= 1
          return item
  
  
  
  
  
  
  
    def  UpperCamelCase__      (	self						):
  
       """simple docstring"""
       return self.head is None
  
  
  
  
  
  
  
    def __str__(	self						):
  
       """simple docstring"""
       if self.is_empty():
          return ""
       else:
          UpperCAmelCase_      :      str      =					self.head
          UpperCAmelCase_      :      str      =					""
          UpperCAmelCase_      :      list[str]      =					[]
          while iterate:
             item_list.append(str(iterate.item						)						)
             UpperCAmelCase_      :      Tuple      =					iterate.next
  
          UpperCAmelCase_      :      Optional[Any]      =					" --> ".join(lowercase_						)
  
          return item_str
  
  
  
  
  
  
  
    def __len__(	self						):
  
       """simple docstring"""
       return self.size
  
  
  