



def     __lowercase(	UpperCAmelCase__ ):


      """simple docstring"""



      lowerCamelCase								=		[0] * len(UpperCAmelCase__ )
      lowerCamelCase								=		[]
      lowerCamelCase								=		[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:
            lowerCamelCase								=		queue.pop(0 )
            for x in graph[vertex]:
                  indegree[x] -= 1

                  if long_dist[vertex] + 1 > long_dist[x]:
                        lowerCamelCase								=		long_dist[vertex] + 1

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

      print(max(UpperCAmelCase__ ) )


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






longest_distance(graph)




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a_						:     List[str]	     =		{
    'configuration_clipseg': [
        'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'CLIPSegConfig',
        'CLIPSegTextConfig',
        'CLIPSegVisionConfig',
    ],
    'processing_clipseg': ['CLIPSegProcessor'],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     a_						:     Any	     =		[
         'CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST',
         'CLIPSegModel',
         'CLIPSegPreTrainedModel',
         'CLIPSegTextModel',
         'CLIPSegVisionModel',
         'CLIPSegForImageSegmentation',
     ]

if TYPE_CHECKING:
     from .configuration_clipseg import (
         CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP,
         CLIPSegConfig,
         CLIPSegTextConfig,
         CLIPSegVisionConfig,
     )
     from .processing_clipseg import CLIPSegProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_clipseg import (
              CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST,
              CLIPSegForImageSegmentation,
              CLIPSegModel,
              CLIPSegPreTrainedModel,
              CLIPSegTextModel,
              CLIPSegVisionModel,
          )

else:
     import sys

     a_						:     Dict	     =		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)