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







class 			__A:




				def __init__(     self		,     _snake_case				)    ->      List[Any]:


								'''simple docstring'''




								__a										=    str(id_				)
								__a										=    None
								__a										=    None
								__a										=    []
								__a										=    {}  # {vertex:distance}




				def __lt__(     self		,     _snake_case				)    ->      List[Any]:


								'''simple docstring'''




								return self.key < other.key




				def __repr__(     self				)    ->      Optional[int]:


								'''simple docstring'''




								return self.id




				def 				SCREAMING_SNAKE_CASE_		(     self		,     _snake_case				)    ->      int:


								'''simple docstring'''




								self.neighbors.append(_snake_case				)




				def 				SCREAMING_SNAKE_CASE_		(     self		,     _snake_case		,     _snake_case				)    ->      Optional[Any]:


								'''simple docstring'''




								__a										=    weight



def     __lowerCAmelCase			(			a__						,    a__						,    a__						,    a__  )       ->  Tuple:
				# 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]						,    a__  )
				graph[b - 1].add_edge(graph[a - 1]						,    a__  )


def     __lowerCAmelCase			(			a__						,    a__  )       ->  list:
				__a										=    []
				for u in graph:
								__a										=    math.inf
								__a										=    None
				__a										=    0
				__a										=    graph[:]
				while q:
								__a										=    min(a__  )
								q.remove(a__  )
								for v in u.neighbors:
												if (v in q) and (u.edges[v.id] < v.key):
																__a										=    u
																__a										=    u.edges[v.id]
				for i in range(1						,    len(a__  )  ):
								a.append((int(graph[i].id  ) + 1, int(graph[i].pi.id  ) + 1)  )
				return a


def     __lowerCAmelCase			(			a__						,    a__  )       ->  Iterator[tuple]:
				for u in graph:
								__a										=    math.inf
								__a										=    None
				__a										=    0

				__a										=    list(a__  )
				hq.heapify(a__  )

				while h:
								__a										=    hq.heappop(a__  )
								for v in u.neighbors:
												if (v in h) and (u.edges[v.id] < v.key):
																__a										=    u
																__a										=    u.edges[v.id]
																hq.heapify(a__  )

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


def     __lowerCAmelCase			(			)       ->  None:
				pass


if __name__ == "__main__":
					import doctest

					doctest.testmod()






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


UpperCAmelCase						:   Any			  =     {
    '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCAmelCase						:   Any			  =     [
				    '''FALCON_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''FalconForCausalLM''',
				    '''FalconModel''',
				    '''FalconPreTrainedModel''',
				    '''FalconForSequenceClassification''',
				    '''FalconForTokenClassification''',
				    '''FalconForQuestionAnswering''',
				]


if TYPE_CHECKING:
				from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_falcon import (
								    FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
								    FalconForCausalLM,
								    FalconForQuestionAnswering,
								    FalconForSequenceClassification,
								    FalconForTokenClassification,
								    FalconModel,
								    FalconPreTrainedModel,
								)


else:
				import sys

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




