






"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


UpperCAmelCase_     :				List[str]         =				{
    """configuration_transfo_xl""": ["""TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TransfoXLConfig"""],
    """tokenization_transfo_xl""": ["""TransfoXLCorpus""", """TransfoXLTokenizer"""],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_     :				List[str]         =				[
      """TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """AdaptiveEmbedding""",
      """TransfoXLForSequenceClassification""",
      """TransfoXLLMHeadModel""",
      """TransfoXLModel""",
      """TransfoXLPreTrainedModel""",
      """load_tf_weights_in_transfo_xl""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase_     :				Optional[Any]         =				[
      """TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFAdaptiveEmbedding""",
      """TFTransfoXLForSequenceClassification""",
      """TFTransfoXLLMHeadModel""",
      """TFTransfoXLMainLayer""",
      """TFTransfoXLModel""",
      """TFTransfoXLPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_transfo_xl import TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP, TransfoXLConfig
  from .tokenization_transfo_xl import TransfoXLCorpus, TransfoXLTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_transfo_xl import (
        TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
        AdaptiveEmbedding,
        TransfoXLForSequenceClassification,
        TransfoXLLMHeadModel,
        TransfoXLModel,
        TransfoXLPreTrainedModel,
        load_tf_weights_in_transfo_xl,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_transfo_xl import (
        TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFAdaptiveEmbedding,
        TFTransfoXLForSequenceClassification,
        TFTransfoXLLMHeadModel,
        TFTransfoXLMainLayer,
        TFTransfoXLModel,
        TFTransfoXLPreTrainedModel,
    )

else:
  import sys

  UpperCAmelCase_     :				Any         =				_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)










"""simple docstring"""






from collections import defaultdict

from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst



def       _A    ()				-> Union[str, Any]:
    """simple docstring"""






    SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_   :						Tuple							=	9, 14  # noqa: F841
    SCREAMING_SNAKE_CASE_   :						Tuple							=	[
        [0, 1, 4],
        [0, 7, 8],
        [1, 2, 8],
        [7, 8, 7],
        [7, 6, 1],
        [2, 8, 2],
        [8, 6, 6],
        [2, 3, 7],
        [2, 5, 4],
        [6, 5, 2],
        [3, 5, 14],
        [3, 4, 9],
        [5, 4, 10],
        [1, 7, 11],
    ]

    SCREAMING_SNAKE_CASE_   :						Dict							=	defaultdict(__a							)
    for nodea, nodea, cost in edges:
        adjancency[nodea].append([nodea, cost]							)
        adjancency[nodea].append([nodea, cost]							)

    SCREAMING_SNAKE_CASE_   :						Any							=	mst(__a							)

    SCREAMING_SNAKE_CASE_   :						Optional[int]							=	[
        [7, 6, 1],
        [2, 8, 2],
        [6, 5, 2],
        [0, 1, 4],
        [2, 5, 4],
        [2, 3, 7],
        [0, 7, 8],
        [3, 4, 9],
    ]

    for answer in expected:
        SCREAMING_SNAKE_CASE_   :						Dict							=	tuple(answer[:2]							)
        SCREAMING_SNAKE_CASE_   :						Optional[int]							=	tuple(edge[::-1]							)
        assert edge in result or reverse in result


