


'''simple docstring'''







def 			lowercase				(_A					):







       """simple docstring"""







       _lowerCAmelCase    :							Tuple   			=       [0] * len(_A					)
       _lowerCAmelCase    :							Dict   			=       []
       _lowerCAmelCase    :							List[Any]   			=       [1] * len(_A					)

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

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

       while queue:
              _lowerCAmelCase    :							List[str]   			=       queue.pop(0					)
              for x in graph[vertex]:
                     indegree[x] -= 1

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

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

       print(max(_A					)					)


# Adjacency list of Graph
lowerCAmelCase    :     Optional[int]					=						{0: [2, 3, 4], 1: [2, 7], 2: [5], 3: [5, 7], 4: [7], 5: [6], 6: [7], 7: []}
longest_distance(graph)





'''simple docstring'''







import unittest

from knapsack import greedy_knapsack as kp
class 	UpperCamelCase__					( unittest.TestCase	):



     """simple docstring"""






     def a	( self   ):

            '''simple docstring'''

            _lowerCAmelCase    :							Union[str, Any]   			=       [10, 20, 30, 40, 50, 60]
            _lowerCAmelCase    :							Union[str, Any]   			=       [2, 4, 6, 8, 10, 12]
            _lowerCAmelCase    :							Dict   			=       100
            self.assertEqual(kp.calc_profit(snake_case__      ,	snake_case__      ,	snake_case__   )      ,	210   )







     def a	( self   ):

            '''simple docstring'''

            self.assertRaisesRegex(snake_case__      ,	'max_weight must greater than zero.'   )







     def a	( self   ):

            '''simple docstring'''

            self.assertRaisesRegex(snake_case__      ,	'Weight can not be negative.'   )







     def a	( self   ):

            '''simple docstring'''

            self.assertRaisesRegex(snake_case__      ,	'Profit can not be negative.'   )







     def a	( self   ):

            '''simple docstring'''

            self.assertRaisesRegex(snake_case__      ,	'max_weight must greater than zero.'   )







     def a	( self   ):

            '''simple docstring'''

            self.assertRaisesRegex(
                snake_case__      ,	'The length of profit and weight must be same.'   )


if __name__ == "__main__":
       unittest.main()

