

"""simple docstring"""





class 					_lowerCAmelCase  :







 """simple docstring"""







 def __init__(			self							:			int	):
    __lowercase								=						{}


 def 					_lowercase (			self							:			Optional[Any]	):
    print(self.vertex	)
    for i in self.vertex:
       print(UpperCAmelCase__,					" -> ",					" -> ".join([str(UpperCAmelCase__	) for j in self.vertex[i]]	)	)


 def 					_lowercase (			self							:			Optional[Any],					UpperCAmelCase__							:			int,					UpperCAmelCase__							:			int	):
    # check if vertex is already present,
    if from_vertex in self.vertex:
       self.vertex[from_vertex].append(UpperCAmelCase__	)
    else:
       # else make a new vertex
       __lowercase								=						[to_vertex]


 def 					_lowercase (			self							:			Dict	):
    # visited array for storing already visited nodes
    __lowercase								=						[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 					_lowercase (			self							:			Union[str, Any],					UpperCAmelCase__							:			int,					UpperCAmelCase__							:			list	):
    # mark start vertex as visited
    __lowercase								=						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__":
   _a       =							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"""





def   _A  (  UpperCamelCase_     :       list[int])	->						float:
   '''simple docstring'''


   if not nums:  # Makes sure that the list is not empty
      raise ValueError("List is empty")

   __lowercase								=						sum(UpperCamelCase_) / len(UpperCamelCase_)  # Calculate the average
   return sum(abs(x - average) for x in nums) / len(UpperCamelCase_)


if __name__ == "__main__":
   import doctest

   doctest.testmod()




