"""simple docstring"""



from collections import deque
from math import floor
from random import random
from time import time

class SCREAMING_SNAKE_CASE  :







 """simple docstring"""


 def __init__( self		:   Tuple					)					->      int:




    '''simple docstring'''






    a__  					=		{}


 def 							_lowerCAmelCase					( self		:   Optional[Any]       , _snake_case		:   List[Any]       , _snake_case		:   Dict       , _snake_case		:   Optional[Any]=1					)					->      Union[str, Any]:




    '''simple docstring'''






    if self.graph.get(_snake_case					):
       if self.graph[u].count([w, v]					) == 0:
          self.graph[u].append([w, v]					)
    else:
       a__  					=		[[w, v]]
    if not self.graph.get(_snake_case					):
       a__  					=		[]


 def 							_lowerCAmelCase					( self		:   Optional[int]					)					->      str:




    '''simple docstring'''






    return list(self.graph					)


 def 							_lowerCAmelCase					( self		:   Optional[Any]       , _snake_case		:   Tuple       , _snake_case		:   Optional[Any]					)					->      List[str]:




    '''simple docstring'''






    if self.graph.get(_snake_case					):
       for _ in self.graph[u]:
          if _[1] == v:
             self.graph[u].remove(_snake_case					)


 def 							_lowerCAmelCase					( self		:   Tuple       , _snake_case		:   Any=-2       , _snake_case		:   Optional[Any]=-1					)					->      Optional[Any]:




    '''simple docstring'''






    if s == d:
       return []
    a__  					=		[]
    a__  					=		[]
    if s == -2:
       a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		s

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if visited.count(node[1]					) < 1:
                if node[1] == d:
                   visited.append(_snake_case					)
                   return visited
                else:
                   stack.append(node[1]					)
                   visited.append(node[1]					)
                   a__  					=		node[1]
                   break

          # check if all the children are visited
       if s == ss:
          stack.pop()
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return visited


 def 							_lowerCAmelCase					( self		:   str       , _snake_case		:   str=-1					)					->      Any:




    '''simple docstring'''






    if c == -1:
       a__  					=		floor(random() * 1_0000					) + 10
    for i in range(_snake_case					):
       # every vertex has max 100 edges
       for _ in range(floor(random() * 102					) + 1					):
          a__  					=		floor(random() * c					) + 1
          if n != i:
             self.add_pair(_snake_case       , _snake_case       , 1					)


 def 							_lowerCAmelCase					( self		:   Any       , _snake_case		:   str=-2					)					->      Dict:




    '''simple docstring'''






    a__  					=		deque()
    a__  					=		[]
    if s == -2:
       a__  					=		list(self.graph					)[0]
    d.append(_snake_case					)
    visited.append(_snake_case					)
    while d:
       a__  					=		d.popleft()
       if len(self.graph[s]					) != 0:
          for node in self.graph[s]:
             if visited.count(node[1]					) < 1:
                d.append(node[1]					)
                visited.append(node[1]					)
    return visited


 def 							_lowerCAmelCase					( self		:   Union[str, Any]       , _snake_case		:   Dict					)					->      str:




    '''simple docstring'''






    a__  					=		0
    for x in self.graph:
       for y in self.graph[x]:
          if y[1] == u:
             count += 1
    return count


 def 							_lowerCAmelCase					( self		:   List[Any]       , _snake_case		:   Optional[int]					)					->      Dict:




    '''simple docstring'''






    return len(self.graph[u]					)


 def 							_lowerCAmelCase					( self		:   Union[str, Any]       , _snake_case		:   List[Any]=-2					)					->      List[str]:




    '''simple docstring'''






    a__  					=		[]
    a__  					=		[]
    if s == -2:
       a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		s
    a__  					=		[]

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if visited.count(node[1]					) < 1:
                stack.append(node[1]					)
                visited.append(node[1]					)
                a__  					=		node[1]
                break

          # check if all the children are visited
       if s == ss:
          sorted_nodes.append(stack.pop()					)
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return sorted_nodes


 def 							_lowerCAmelCase					( self		:   Any					)					->      int:




    '''simple docstring'''






    a__  					=		[]
    a__  					=		[]
    a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		-2
    a__  					=		[]
    a__  					=		s
    a__  					=		False
    a__  					=		set()

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if (
                 visited.count(node[1]					) > 0
                 and node[1] != parent
                 and indirect_parents.count(node[1]					) > 0
                 and not on_the_way_back
             ):
                a__  					=		len(_snake_case					) - 1
                while len_stack >= 0:
                   if stack[len_stack] == node[1]:
                      anticipating_nodes.add(node[1]					)
                      break
                   else:
                      anticipating_nodes.add(stack[len_stack]					)
                      len_stack -= 1
             if visited.count(node[1]					) < 1:
                stack.append(node[1]					)
                visited.append(node[1]					)
                a__  					=		node[1]
                break

          # check if all the children are visited
       if s == ss:
          stack.pop()
          a__  					=		True
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		False
          indirect_parents.append(_snake_case					)
          a__  					=		s
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return list(_snake_case					)


 def 							_lowerCAmelCase					( self		:   Tuple					)					->      Tuple:




    '''simple docstring'''






    a__  					=		[]
    a__  					=		[]
    a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		-2
    a__  					=		[]
    a__  					=		s
    a__  					=		False
    a__  					=		set()

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if (
                 visited.count(node[1]					) > 0
                 and node[1] != parent
                 and indirect_parents.count(node[1]					) > 0
                 and not on_the_way_back
             ):
                a__  					=		len(_snake_case					) - 1
                while len_stack_minus_one >= 0:
                   if stack[len_stack_minus_one] == node[1]:
                      anticipating_nodes.add(node[1]					)
                      break
                   else:
                      return True
             if visited.count(node[1]					) < 1:
                stack.append(node[1]					)
                visited.append(node[1]					)
                a__  					=		node[1]
                break

          # check if all the children are visited
       if s == ss:
          stack.pop()
          a__  					=		True
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		False
          indirect_parents.append(_snake_case					)
          a__  					=		s
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return False


 def 							_lowerCAmelCase					( self		:   Any       , _snake_case		:   Dict=-2       , _snake_case		:   Any=-1					)					->      Any:




    '''simple docstring'''






    a__  					=		time()
    self.dfs(_snake_case       , _snake_case					)
    a__  					=		time()
    return end - begin



 def 							_lowerCAmelCase					( self		:   Tuple       , _snake_case		:   Any=-2					)					->      Tuple:




    '''simple docstring'''






    a__  					=		time()
    self.bfs(_snake_case					)
    a__  					=		time()
    return end - begin

class SCREAMING_SNAKE_CASE  :







 """simple docstring"""


 def __init__( self		:   Tuple					)					->      str:




    '''simple docstring'''






    a__  					=		{}


 def 							_lowerCAmelCase					( self		:   str       , _snake_case		:   Any       , _snake_case		:   Optional[int]       , _snake_case		:   int=1					)					->      int:




    '''simple docstring'''






    if self.graph.get(_snake_case					):
       # if there already is a edge
       if self.graph[u].count([w, v]					) == 0:
          self.graph[u].append([w, v]					)
    else:
       # if u does not exist
       a__  					=		[[w, v]]
    # add the other way
    if self.graph.get(_snake_case					):
       # if there already is a edge
       if self.graph[v].count([w, u]					) == 0:
          self.graph[v].append([w, u]					)
    else:
       # if u does not exist
       a__  					=		[[w, u]]


 def 							_lowerCAmelCase					( self		:   Dict       , _snake_case		:   str       , _snake_case		:   Union[str, Any]					)					->      int:




    '''simple docstring'''






    if self.graph.get(_snake_case					):
       for _ in self.graph[u]:
          if _[1] == v:
             self.graph[u].remove(_snake_case					)
        # the other way round
    if self.graph.get(_snake_case					):
       for _ in self.graph[v]:
          if _[1] == u:
             self.graph[v].remove(_snake_case					)


 def 							_lowerCAmelCase					( self		:   List[str]       , _snake_case		:   Any=-2       , _snake_case		:   Tuple=-1					)					->      Union[str, Any]:




    '''simple docstring'''






    if s == d:
       return []
    a__  					=		[]
    a__  					=		[]
    if s == -2:
       a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		s

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if visited.count(node[1]					) < 1:
                if node[1] == d:
                   visited.append(_snake_case					)
                   return visited
                else:
                   stack.append(node[1]					)
                   visited.append(node[1]					)
                   a__  					=		node[1]
                   break

          # check if all the children are visited
       if s == ss:
          stack.pop()
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return visited


 def 							_lowerCAmelCase					( self		:   Union[str, Any]       , _snake_case		:   List[str]=-1					)					->      Optional[Any]:




    '''simple docstring'''






    if c == -1:
       a__  					=		floor(random() * 1_0000					) + 10
    for i in range(_snake_case					):
       # every vertex has max 100 edges
       for _ in range(floor(random() * 102					) + 1					):
          a__  					=		floor(random() * c					) + 1
          if n != i:
             self.add_pair(_snake_case       , _snake_case       , 1					)


 def 							_lowerCAmelCase					( self		:   int       , _snake_case		:   List[Any]=-2					)					->      Union[str, Any]:




    '''simple docstring'''






    a__  					=		deque()
    a__  					=		[]
    if s == -2:
       a__  					=		list(self.graph					)[0]
    d.append(_snake_case					)
    visited.append(_snake_case					)
    while d:
       a__  					=		d.popleft()
       if len(self.graph[s]					) != 0:
          for node in self.graph[s]:
             if visited.count(node[1]					) < 1:
                d.append(node[1]					)
                visited.append(node[1]					)
    return visited


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




    '''simple docstring'''






    return len(self.graph[u]					)


 def 							_lowerCAmelCase					( self		:   Dict					)					->      Tuple:




    '''simple docstring'''






    a__  					=		[]
    a__  					=		[]
    a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		-2
    a__  					=		[]
    a__  					=		s
    a__  					=		False
    a__  					=		set()

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if (
                 visited.count(node[1]					) > 0
                 and node[1] != parent
                 and indirect_parents.count(node[1]					) > 0
                 and not on_the_way_back
             ):
                a__  					=		len(_snake_case					) - 1
                while len_stack >= 0:
                   if stack[len_stack] == node[1]:
                      anticipating_nodes.add(node[1]					)
                      break
                   else:
                      anticipating_nodes.add(stack[len_stack]					)
                      len_stack -= 1
             if visited.count(node[1]					) < 1:
                stack.append(node[1]					)
                visited.append(node[1]					)
                a__  					=		node[1]
                break

          # check if all the children are visited
       if s == ss:
          stack.pop()
          a__  					=		True
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		False
          indirect_parents.append(_snake_case					)
          a__  					=		s
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return list(_snake_case					)


 def 							_lowerCAmelCase					( self		:   Dict					)					->      int:




    '''simple docstring'''






    a__  					=		[]
    a__  					=		[]
    a__  					=		list(self.graph					)[0]
    stack.append(_snake_case					)
    visited.append(_snake_case					)
    a__  					=		-2
    a__  					=		[]
    a__  					=		s
    a__  					=		False
    a__  					=		set()

    while True:
       # check if there is any non isolated nodes
       if len(self.graph[s]					) != 0:
          a__  					=		s
          for node in self.graph[s]:
             if (
                 visited.count(node[1]					) > 0
                 and node[1] != parent
                 and indirect_parents.count(node[1]					) > 0
                 and not on_the_way_back
             ):
                a__  					=		len(_snake_case					) - 1
                while len_stack_minus_one >= 0:
                   if stack[len_stack_minus_one] == node[1]:
                      anticipating_nodes.add(node[1]					)
                      break
                   else:
                      return True
             if visited.count(node[1]					) < 1:
                stack.append(node[1]					)
                visited.append(node[1]					)
                a__  					=		node[1]
                break

          # check if all the children are visited
       if s == ss:
          stack.pop()
          a__  					=		True
          if len(_snake_case					) != 0:
             a__  					=		stack[len(_snake_case					) - 1]
       else:
          a__  					=		False
          indirect_parents.append(_snake_case					)
          a__  					=		s
          a__  					=		ss

       # check if se have reached the starting point
       if len(_snake_case					) == 0:
          return False


 def 							_lowerCAmelCase					( self		:   str					)					->      Union[str, Any]:




    '''simple docstring'''






    return list(self.graph					)


 def 							_lowerCAmelCase					( self		:   str       , _snake_case		:   int=-2       , _snake_case		:   List[str]=-1					)					->      Dict:




    '''simple docstring'''






    a__  					=		time()
    self.dfs(_snake_case       , _snake_case					)
    a__  					=		time()
    return end - begin



 def 							_lowerCAmelCase					( self		:   Tuple       , _snake_case		:   List[str]=-2					)					->      Any:




    '''simple docstring'''






    a__  					=		time()
    self.bfs(_snake_case					)
    a__  					=		time()
    return end - begin









'''simple docstring'''

from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a   	=    {
    "configuration_informer": [
        "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "InformerConfig",
    ],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    a   	=    [
        "INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
        "InformerForPrediction",
        "InformerModel",
        "InformerPreTrainedModel",
    ]


if TYPE_CHECKING:
    from .configuration_informer import INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, InformerConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_informer import (
            INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            InformerForPrediction,
            InformerModel,
            InformerPreTrainedModel,
        )

else:
    import sys

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





