




'''simple docstring'''


from typing import TYPE_CHECKING

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


_lowercase  =			{"""configuration_reformer""": ["""REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ReformerConfig"""]}

try:
	if not is_sentencepiece_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowercase  =			["""ReformerTokenizer"""]

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowercase  =			["""ReformerTokenizerFast"""]

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowercase  =			[
	    """REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """ReformerAttention""",
	    """ReformerForMaskedLM""",
	    """ReformerForQuestionAnswering""",
	    """ReformerForSequenceClassification""",
	    """ReformerLayer""",
	    """ReformerModel""",
	    """ReformerModelWithLMHead""",
	    """ReformerPreTrainedModel""",
	]


if TYPE_CHECKING:
	from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig

	try:
		if not is_sentencepiece_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_reformer import ReformerTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_reformer_fast import ReformerTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_reformer import (
		    REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    ReformerAttention,
		    ReformerForMaskedLM,
		    ReformerForQuestionAnswering,
		    ReformerForSequenceClassification,
		    ReformerLayer,
		    ReformerModel,
		    ReformerModelWithLMHead,
		    ReformerPreTrainedModel,
		)

else:
	import sys

	_lowercase  =			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


import math
class     lowerCAmelCase_     :







							def __init__(   self      :     Tuple ,			_A      :     int=0		):  # a graph with Node 0,1,...,N-1
												_UpperCamelCase			     =     n
												_UpperCamelCase			     =     [
												    [math.inf for j in range(0 ,			_A		)] for i in range(0 ,			_A		)
												]  # adjacency matrix for weight
												_UpperCamelCase			     =     [
												    [math.inf for j in range(0 ,			_A		)] for i in range(0 ,			_A		)
												]  # dp[i][j] stores minimum distance from i to j







							def  UpperCamelCase_						(   self      :     Dict ,			_A      :     str ,			_A      :     List[str] ,			_A      :     Optional[Any]		):
												_UpperCamelCase			     =     w







							def  UpperCamelCase_						(   self      :     Optional[int]		):
												for k in range(0 ,			self.n		):
																	for i in range(0 ,			self.n		):
																						for j in range(0 ,			self.n		):
																											_UpperCamelCase			     =     min(self.dp[i][j] ,			self.dp[i][k] + self.dp[k][j]		)







							def  UpperCamelCase_						(   self      :     List[str] ,			_A      :     Optional[int] ,			_A      :     Optional[int]		):
												return self.dp[u][v]


if __name__ == "__main__":
					_lowerCAmelCase       =		Graph(5)
					graph.add_edge(0, 2, 9)
					graph.add_edge(0, 4, 10)
					graph.add_edge(1, 3, 5)
					graph.add_edge(2, 3, 7)
					graph.add_edge(3, 0, 10)
					graph.add_edge(3, 1, 2)
					graph.add_edge(3, 2, 1)
					graph.add_edge(3, 4, 6)
					graph.add_edge(4, 1, 3)
					graph.add_edge(4, 2, 4)
					graph.add_edge(4, 3, 9)
					graph.floyd_warshall()
					graph.show_min(1, 4)
					graph.show_min(0, 3)
