






"""simple docstring"""



from __future__ import annotations

from queue import Queue

class 			a	:







    def __init__(     self			):
      lowercase				       =			{}







    def      UpperCamelCase_ (     self			):
      for i in self.vertices:
        print(_lowerCamelCase				,						' : '				,						' -> '.join([str(_lowerCamelCase			) for j in self.vertices[i]]			)			)







    def      UpperCamelCase_ (     self				,						_lowerCamelCase				,						_lowerCamelCase			):
      if from_vertex in self.vertices:
        self.vertices[from_vertex].append(_lowerCamelCase			)
      else:
        lowercase				       =			[to_vertex]







    def      UpperCamelCase_ (     self				,						_lowerCamelCase			):
      lowercase				       =			set()

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

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

      while not queue.empty():
        lowercase				       =			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						:    List[str]		=						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"""




import os
import sys
import time

from . import transposition_cipher as trans_cipher





def 			a_							(				):
						_UpperCamelCase     :   Dict      =       '''Prehistoric Men.txt'''
						_UpperCamelCase     :   Optional[Any]      =       '''Output.txt'''
						_UpperCamelCase     :   Any      =       int(input('''Enter key: '''  )  )
						_UpperCamelCase     :   Optional[Any]      =       input('''Encrypt/Decrypt [e/d]: '''  )

						if not os.path.exists(_lowercase  ):
												print(F"""File {input_file} does not exist. Quitting..."""  )
												sys.exit()
						if os.path.exists(_lowercase  ):
												print(F"""Overwrite {output_file}? [y/n]"""  )
												_UpperCamelCase     :   Optional[int]      =       input('''> '''  )
												if not response.lower().startswith('''y'''  ):
																		sys.exit()

						_UpperCamelCase     :   List[str]      =       time.time()
						if mode.lower().startswith('''e'''  ):
												with open(_lowercase  ) as f:
																		_UpperCamelCase     :   Optional[int]      =       f.read()
												_UpperCamelCase     :   List[str]      =       trans_cipher.encrypt_message(_lowercase			,		_lowercase  )
						elif mode.lower().startswith('''d'''  ):
												with open(_lowercase  ) as f:
																		_UpperCamelCase     :   Dict      =       f.read()
												_UpperCamelCase     :   Any      =       trans_cipher.decrypt_message(_lowercase			,		_lowercase  )

						with open(_lowercase			,		'''w'''  ) as output_obj:
												output_obj.write(_lowercase  )

						_UpperCamelCase     :   List[str]      =       round(time.time() - start_time			,		2  )
						print(('''Done (''', total_time, '''seconds )''')  )


if __name__ == "__main__":
						main()



