


'''simple docstring'''

class 						__SCREAMING_SNAKE_CASE					:






     def __init__(			self		)       ->    List[str]:
          _a						=		{}






     def  a_					(			self		)       ->    None:
          print(self.vertex		)
          for i in self.vertex:
               print(__UpperCamelCase     ,							" -> "     ,							" -> ".join([str(__UpperCamelCase		) for j in self.vertex[i]]		)		)






     def  a_					(			self     ,							__UpperCamelCase     ,							__UpperCamelCase		)       ->    None:
          # check if vertex is already present,
          if from_vertex in self.vertex:
               self.vertex[from_vertex].append(__UpperCamelCase		)
          else:
               # else make a new vertex
               _a						=		[to_vertex]






     def  a_					(			self		)       ->    None:
          # visited array for storing already visited nodes
          _a						=		[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  a_					(			self     ,							__UpperCamelCase     ,							__UpperCamelCase		)       ->    None:
          # mark start vertex as visited
          _a						=		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__":
   lowercase__				     =		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





'''simple docstring'''

from math import factorial, pi






def __UpperCamelCase   (			__lowerCamelCase		: float      ,  __lowerCamelCase		: int = 30				)      ->     float:







     '''simple docstring'''






     if not isinstance(__lowerCamelCase      ,  (int, float)				):
          raise ValueError("maclaurin_sin() requires either an int or float for theta"				)

     if not isinstance(__lowerCamelCase      ,  __lowerCamelCase				) or accuracy <= 0:
          raise ValueError("maclaurin_sin() requires a positive int for accuracy"				)

     _a						=		float(__lowerCamelCase				)
     _a						=		theta // (2 * pi)
     theta -= 2 * div * pi
     return sum(
         (-1) ** r * theta ** (2 * r + 1) / factorial(2 * r + 1				) for r in range(__lowerCamelCase				)				)






def __UpperCamelCase   (			__lowerCamelCase		: float      ,  __lowerCamelCase		: int = 30				)      ->     float:







     '''simple docstring'''






     if not isinstance(__lowerCamelCase      ,  (int, float)				):
          raise ValueError("maclaurin_cos() requires either an int or float for theta"				)

     if not isinstance(__lowerCamelCase      ,  __lowerCamelCase				) or accuracy <= 0:
          raise ValueError("maclaurin_cos() requires a positive int for accuracy"				)

     _a						=		float(__lowerCamelCase				)
     _a						=		theta // (2 * pi)
     theta -= 2 * div * pi
     return sum((-1) ** r * theta ** (2 * r) / factorial(2 * r				) for r in range(__lowerCamelCase				)				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   print(maclaurin_sin(10))
   print(maclaurin_sin(-10))
   print(maclaurin_sin(10, 15))
   print(maclaurin_sin(-10, 15))

   print(maclaurin_cos(5))
   print(maclaurin_cos(-5))
   print(maclaurin_cos(10, 15))
   print(maclaurin_cos(-10, 15))

