





"""simple docstring"""


from __future__ import annotations

from queue import Queue



class      lowercase_				:

       def __init__(			self     ):






        '''simple docstring'''

        snake_case__    							=				{}

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        for i in self.vertices:
         print(__SCREAMING_SNAKE_CASE   ,					" : "   ,					" -> ".join([str(__SCREAMING_SNAKE_CASE     ) for j in self.vertices[i]]     )     )

       def 		_SCREAMING_SNAKE_CASE(			self   ,					__SCREAMING_SNAKE_CASE   ,					__SCREAMING_SNAKE_CASE     ):






        '''simple docstring'''

        if from_vertex in self.vertices:
         self.vertices[from_vertex].append(__SCREAMING_SNAKE_CASE     )
        else:
         snake_case__    							=				[to_vertex]

       def 		_SCREAMING_SNAKE_CASE(			self   ,					__SCREAMING_SNAKE_CASE     ):






        '''simple docstring'''

        snake_case__    							=				set()

        # create a first in first out queue to store all the vertices for BFS
        snake_case__    							=				Queue()

        # mark the source node as visited and enqueue it
        visited.add(__SCREAMING_SNAKE_CASE     )
        queue.put(__SCREAMING_SNAKE_CASE     )

        while not queue.empty():
         snake_case__    							=				queue.get()

         # loop through all adjacent vertex and enqueue it if not yet visited
         for adjacent_vertex in self.vertices[vertex]:
          if adjacent_vertex not in visited:
           queue.put(__SCREAMING_SNAKE_CASE     )
           visited.add(__SCREAMING_SNAKE_CASE     )
        return visited


if __name__ == "__main__":
   from doctest import testmod

   testmod(verbose=True)

   a__					:     Optional[int]							=				Graph()
   g.add_edge(0, 1)
   g.add_edge(0, 2)
   g.add_edge(1, 2)
   g.add_edge(2, 0)
   g.add_edge(2, 3)
   g.add_edge(3, 3)

   g.print_graph()
   # 0  :  1 -> 2
   # 1  :  2
   # 2  :  0 -> 3
   # 3  :  3

   assert sorted(g.bfs(2)) == [0, 1, 2, 3]








"""simple docstring"""


def 							a__			(  _UpperCAmelCase	)    ->  int:

 '''simple docstring'''






 return int(_UpperCAmelCase	) if x - int(_UpperCAmelCase	) <= 0 else int(_UpperCAmelCase	) + 1


if __name__ == "__main__":
   import doctest

   doctest.testmod()

