






from __future__ import annotations

from queue import Queue
class 	a_:



     """simple docstring"""



     def __init__(		self					:	str)							->	None:

      """simple docstring"""
      SCREAMING_SNAKE_CASE				    =		{}





     def     __UpperCamelCase						(		self					:	List[Any])							->	None:

      """simple docstring"""
      for i in self.vertices:
       print(lowerCAmelCase__  ,  ' : '  ,  ' -> '.join([str(lowerCAmelCase__) for j in self.vertices[i]]))





     def     __UpperCamelCase						(		self					:	List[Any]  ,  lowerCAmelCase__					:	int  ,  lowerCAmelCase__					:	int)							->	None:

      """simple docstring"""
      if from_vertex in self.vertices:
       self.vertices[from_vertex].append(lowerCAmelCase__)
      else:
       SCREAMING_SNAKE_CASE				    =		[to_vertex]





     def     __UpperCamelCase						(		self					:	str  ,  lowerCAmelCase__					:	int)							->	set[int]:

      """simple docstring"""
      SCREAMING_SNAKE_CASE				    =		set()

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

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

      while not queue.empty():
       SCREAMING_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(lowerCAmelCase__)
         visited.add(lowerCAmelCase__)
      return visited


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

      testmod(verbose=True)

      __UpperCAmelCase      =				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]












# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
__UpperCAmelCase      =				abspath(join(dirname(dirname(dirname(__file__))), "src"))
sys.path.insert(1, git_repo_path)


# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="ignore", category=FutureWarning)





def 						A_					(						lowercase_			)				->str:







 """simple docstring"""

 from transformers.testing_utils import pytest_addoption_shared

 pytest_addoption_shared(lowercase_			)





def 						A_					(						lowercase_			)				->Tuple:







 """simple docstring"""

 from transformers.testing_utils import pytest_terminal_summary_main

 SCREAMING_SNAKE_CASE				    =		terminalreporter.config.getoption('--make-reports'			)
 if make_reports:
  pytest_terminal_summary_main(lowercase_	,  id=lowercase_			)




