
def 							A__       (    lowerCamelCase    )	->						str:
				UpperCamelCase_:				Dict						=    [0] * len(__snake_case    )
				UpperCamelCase_:				List[str]						=    []
				UpperCamelCase_:				Optional[int]						=    [1] * len(__snake_case    )

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

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

				while queue:
								UpperCamelCase_:				Optional[Any]						=    queue.pop(0    )
								for x in graph[vertex]:
												indegree[x] -= 1

												if long_dist[vertex] + 1 > long_dist[x]:
																UpperCamelCase_:				Dict						=    long_dist[vertex] + 1

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

				print(max(__snake_case    )    )


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





longest_distance(graph)














from __future__ import annotations

import csv

import requests
from bsa import BeautifulSoup





def    __lowerCAmelCase   (    __snake_case = ""							):
     __lowerCAmelCase             =       url or "https://www.imdb.com/chart/top/?ref_=nv_mv_250"
     __lowerCAmelCase             =       BeautifulSoup(requests.get(__snake_case							).text       ,			"html.parser"							)
     __lowerCAmelCase             =       soup.find_all("td"       ,			attrs="titleColumn"							)
     __lowerCAmelCase             =       soup.find_all("td"       ,			class_="ratingColumn imdbRating"							)
     return {
         title.a.text: float(rating.strong.text							)
         for title, rating in zip(__snake_case       ,			__snake_case							)
     }





def    __lowerCAmelCase   (    __snake_case = "IMDb_Top_250_Movies.csv"							):
     __lowerCAmelCase             =       get_imdb_top_aaa_movies()
     with open(__snake_case       ,			"w"       ,			newline=""							) as out_file:
          __lowerCAmelCase             =       csv.writer(__snake_case							)
          writer.writerow(["Movie title", "IMDb rating"]							)
          for title, rating in movies.items():
               writer.writerow([title, rating]							)


if __name__ == "__main__":
 write_movies()






