






'''simple docstring'''







import heapq as hq
import math
from collections.abc import Iterator

class _lowercase	:




							def __init__(							self:				int			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	List[str]         =       str(id_     )
														lowerCamelCase__					:	Union[str, Any]         =       None
														lowerCamelCase__					:	Dict         =       None
														lowerCamelCase__					:	Optional[int]         =       []
														lowerCamelCase__					:	int         =       {}  # {vertex:distance}




							def __lt__(							self:				List[str]			,							UpperCamelCase__:				Dict     ):
														return self.key < other.key




							def __repr__(							self:				str     ):
														return self.id




							def 		lowerCamelCase_				(							self:				Any			,							UpperCamelCase__:				int     ):
														self.neighbors.append(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				Union[str, Any]			,							UpperCamelCase__:				Optional[Any]			,							UpperCamelCase__:				Optional[int]     ):
														lowerCamelCase__					:	Any         =       weight





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase      )      ->       Union[str, Any]:
							# add the neighbors:
							graph[a - 1].add_neighbor(graph[b - 1]      )
							graph[b - 1].add_neighbor(graph[a - 1]      )
							# add the edges:
							graph[a - 1].add_edge(graph[b - 1]				,			UpperCamelCase      )
							graph[b - 1].add_edge(graph[a - 1]				,			UpperCamelCase      )





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       list:
							lowerCamelCase__					:	List[Any]         =       []
							for u in graph:
														lowerCamelCase__					:	Optional[int]         =       math.inf
														lowerCamelCase__					:	List[str]         =       None
							lowerCamelCase__					:	List[str]         =       0
							lowerCamelCase__					:	Dict         =       graph[:]
							while q:
														lowerCamelCase__					:	Dict         =       min(UpperCamelCase      )
														q.remove(UpperCamelCase      )
														for v in u.neighbors:
																					if (v in q) and (u.edges[v.id] < v.key):
																												lowerCamelCase__					:	str         =       u
																												lowerCamelCase__					:	Dict         =       u.edges[v.id]
							for i in range(1				,			len(UpperCamelCase      )      ):
														a.append((int(graph[i].id      ) + 1, int(graph[i].pi.id      ) + 1)      )
							return a





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       Iterator[tuple]:
							for u in graph:
														lowerCamelCase__					:	Union[str, Any]         =       math.inf
														lowerCamelCase__					:	Tuple         =       None
							lowerCamelCase__					:	List[str]         =       0

							lowerCamelCase__					:	Optional[Any]         =       list(UpperCamelCase      )
							hq.heapify(UpperCamelCase      )

							while h:
														lowerCamelCase__					:	Dict         =       hq.heappop(UpperCamelCase      )
														for v in u.neighbors:
																					if (v in h) and (u.edges[v.id] < v.key):
																												lowerCamelCase__					:	int         =       u
																												lowerCamelCase__					:	Optional[int]         =       u.edges[v.id]
																												hq.heapify(UpperCamelCase      )

							for i in range(1				,			len(UpperCamelCase      )      ):
														yield (int(graph[i].id      ) + 1, int(graph[i].pi.id      ) + 1)





def  SCREAMING_SNAKE_CASE_       ()      ->       None:
							pass


if __name__ == "__main__":
			import doctest

			doctest.testmod()






"""simple docstring"""

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowercase__    :  str							    =	{
    '''configuration_x_clip''': [
        '''XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''XCLIPConfig''',
        '''XCLIPTextConfig''',
        '''XCLIPVisionConfig''',
    ],
    '''processing_x_clip''': ['''XCLIPProcessor'''],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     lowercase__    :  Tuple							    =	[
         '''XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''XCLIPModel''',
         '''XCLIPPreTrainedModel''',
         '''XCLIPTextModel''',
         '''XCLIPVisionModel''',
     ]

if TYPE_CHECKING:
     from .configuration_x_clip import (
         XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
         XCLIPConfig,
         XCLIPTextConfig,
         XCLIPVisionConfig,
     )
     from .processing_x_clip import XCLIPProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_x_clip import (
              XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
              XCLIPModel,
              XCLIPPreTrainedModel,
              XCLIPTextModel,
              XCLIPVisionModel,
          )

else:
     import sys

     lowercase__    :  Tuple							    =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





