





class        _lowerCAmelCase    :


  '''simple docstring'''







  def __init__(      self      :					Optional[int]							):


    '''simple docstring'''





    _snake_case   :				Any														=	{}







  def UpperCamelCase_ (      self      :					str							):


    '''simple docstring'''





    print(self.vertex							)
    for i in self.vertex:
      print(UpperCamelCase      ,				' -> '      ,				' -> '.join([str(UpperCamelCase							) for j in self.vertex[i]]							)							)







  def UpperCamelCase_ (      self      :					List[Any]      ,				UpperCamelCase      :					int      ,				UpperCamelCase      :					int							):


    '''simple docstring'''





    if from_vertex in self.vertex:
      self.vertex[from_vertex].append(UpperCamelCase							)
    else:
      # else make a new vertex
      _snake_case   :				str														=	[to_vertex]







  def UpperCamelCase_ (      self      :					Tuple							):


    '''simple docstring'''





    _snake_case   :				Any														=	[False] * len(self.vertex							)

    # call the recursive helper function
    for i in range(len(self.vertex							)							):
      if not visited[i]:
        self.dfs_recursive(UpperCamelCase      ,				UpperCamelCase							)







  def UpperCamelCase_ (      self      :					Union[str, Any]      ,				UpperCamelCase      :					int      ,				UpperCamelCase      :					list							):


    '''simple docstring'''





    _snake_case   :				Union[str, Any]														=	True

    print(UpperCamelCase      ,				end=' '							)

    # Recur for all the vertices that are adjacent to this node
    for i in self.vertex:
      if not visited[i]:
        self.dfs_recursive(UpperCamelCase      ,				UpperCamelCase							)


if __name__ == "__main__":
      lowerCAmelCase_						   =    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()
      print("""DFS:""")
      g.dfs()

      # OUTPUT:
      # 0  ->  1 -> 2
      # 1  ->  2
      # 2  ->  0 -> 3
      # 3  ->  3
      # DFS:
      #  0 1 2 3











import copy
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Optional, Union



@dataclass
class        _lowerCAmelCase    :


  '''simple docstring'''
  a_							:       Optional[Union[str, Path]]      					=None
  a_							:       bool      					=False
  a_							:       bool      					=False
  a_							:       bool      					=False
  a_							:       Optional[Dict]      					=None
  a_							:       Optional[str]      					=None
  a_							:       bool      					=False
  a_							:       bool      					=False
  a_							:       bool      					=False
  a_							:       bool      					=True
  a_							:       Optional[int]      					=None
  a_							:       int      					=1
  a_							:       Optional[Union[str, bool]]      					=None
  a_							:       bool      					=False
  a_							:       Optional[Dict]      					=None
  a_							:       Optional[str]      					=None







  def UpperCamelCase_ (      self      :					Dict							):


    '''simple docstring'''





    return self.__class__(**{k: copy.deepcopy(UpperCamelCase							) for k, v in self.__dict__.items()}							)




