

'''simple docstring'''

def 				UpperCamelCase(					UpperCAmelCase_     ):
 UpperCAmelCase	:     List[str]						 =			[0] * len(UpperCAmelCase_     )
 UpperCAmelCase	:     Optional[Any]						 =			[]
 UpperCAmelCase	:     Dict						 =			[1] * len(UpperCAmelCase_     )

 for values in graph.values():
  for i in values:
   indegree[i] += 1

 for i in range(len(UpperCAmelCase_     )     ):
  if indegree[i] == 0:
   queue.append(UpperCAmelCase_     )

 while queue:
  UpperCAmelCase	:     int						 =			queue.pop(0     )
  for x in graph[vertex]:
   indegree[x] -= 1

   if long_dist[vertex] + 1 > long_dist[x]:
    UpperCAmelCase	:     List[Any]						 =			long_dist[vertex] + 1

   if indegree[x] == 0:
    queue.append(UpperCAmelCase_     )

 print(max(UpperCAmelCase_     )     )


# Adjacency list of Graph
lowercase__         =      {0: [2, 3, 4], 1: [2, 7], 2: [5], 3: [5, 7], 4: [7], 5: [6], 6: [7], 7: []}




longest_distance(graph)







'''simple docstring'''

from typing import TYPE_CHECKING

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


lowercase__         =      {"configuration_van": ["VAN_PRETRAINED_CONFIG_ARCHIVE_MAP", "VanConfig"]}


try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowercase__         =      [
     "VAN_PRETRAINED_MODEL_ARCHIVE_LIST",
     "VanForImageClassification",
     "VanModel",
     "VanPreTrainedModel",
 ]

if TYPE_CHECKING:
 from .configuration_van import VAN_PRETRAINED_CONFIG_ARCHIVE_MAP, VanConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_van import (
      VAN_PRETRAINED_MODEL_ARCHIVE_LIST,
      VanForImageClassification,
      VanModel,
      VanPreTrainedModel,
  )

else:
 import sys

 lowercase__         =      _LazyModule(__name__, globals()["__file__"], _import_structure)




