


"""simple docstring"""




from manim import *





class __snake_case		(       _a   ):







   """simple docstring"""




   def SCREAMING_SNAKE_CASE_   (		self				:List[str]							):
          _a							 =					Rectangle(height=0.5					,	width=0.5							)
          _a							 =					Rectangle(height=0.46					,	width=0.46							).set_stroke(width=0							)

          _a							 =					[mem.copy() for i in range(6							)]
          _a							 =					[mem.copy() for i in range(6							)]
          _a							 =					VGroup(*UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0							)
          _a							 =					VGroup(*UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0							)
          _a							 =					VGroup(UpperCamelCase__					,	UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0							)
          _a							 =					Text("CPU"					,	font_size=24							)
          _a							 =					Group(UpperCamelCase__					,	UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0.5					,	aligned_edge=UpperCamelCase__							)
          cpu.move_to([-2.5, -0.5, 0]							)
          self.add(UpperCamelCase__							)

          _a							 =					[mem.copy() for i in range(1							)]
          _a							 =					VGroup(*UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0							)
          _a							 =					Text("GPU"					,	font_size=24							)
          _a							 =					Group(UpperCamelCase__					,	UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0.5					,	aligned_edge=UpperCamelCase__							)
          gpu.align_to(UpperCamelCase__					,	UpperCamelCase__							)
          gpu.set_x(gpu.get_x() - 1							)

          self.add(UpperCamelCase__							)

          _a							 =					[mem.copy() for i in range(6							)]
          _a							 =					VGroup(*UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0							)

          _a							 =					Text("Model"					,	font_size=24							)
          _a							 =					Group(UpperCamelCase__					,	UpperCamelCase__							).arrange(UpperCamelCase__					,	buff=0.5					,	aligned_edge=UpperCamelCase__							)
          model.move_to([3, -1.0, 0]							)

          self.play(
              Create(UpperCamelCase__					,	run_time=1							)					,	Create(UpperCamelCase__					,	run_time=1							)					,	Create(UpperCamelCase__					,	run_time=1							)					,	)

          _a							 =					MarkupText(
              f'First, an empty model skeleton is loaded\ninto <span fgcolor=\'{YELLOW}\'>memory</span> without using much RAM.'					,	font_size=24					,	)

          _a							 =					Square(side_length=2.2							)
          key.move_to([-5, 2, 0]							)

          _a							 =					MarkupText(
              f'<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'					,	font_size=18					,	)

          key_text.move_to([-5, 2.4, 0]							)

          step_a.move_to([2, 2, 0]							)
          self.play(Write(UpperCamelCase__					,	run_time=2.5							)					,	Write(UpperCamelCase__							)					,	Write(UpperCamelCase__							)							)

          self.add(UpperCamelCase__							)

          _a							 =					[]
          _a							 =					[]
          _a							 =					[]
          for i, rect in enumerate(UpperCamelCase__							):
                 _a							 =					Rectangle(height=0.46					,	width=0.46							).set_stroke(width=0.0							).set_fill(UpperCamelCase__					,	opacity=0.7							)
                 cpu_target.move_to(UpperCamelCase__							)
                 cpu_target.generate_target()
                 _a							 =					0.46 / 4
                 _a							 =					0.46 / 3

                 if i == 0:
                        cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT							)					,	buff=0.02					,	direction=UpperCamelCase__							)
                        cpu_target.target.set_x(cpu_target.target.get_x() + 0.1							)
                 elif i == 3:
                        cpu_target.target.next_to(cpu_targs[0].target					,	direction=UpperCamelCase__					,	buff=0.0							)
                 else:
                        cpu_target.target.next_to(cpu_targs[i - 1].target					,	direction=UpperCamelCase__					,	buff=0.0							)
                 cpu_targs.append(UpperCamelCase__							)

                 first_animations.append(rect.animate(run_time=0.5							).set_stroke(UpperCamelCase__							)							)
                 second_animations.append(MoveToTarget(UpperCamelCase__					,	run_time=1.5							)							)

          self.play(*UpperCamelCase__							)
          self.play(*UpperCamelCase__							)

          self.wait()








class 					SCREAMING_SNAKE_CASE_  :
       """simple docstring"""


       def __init__(				self	:List[Any]):



          """simple docstring"""

          _lowercase              ={}





       def 				UpperCamelCase__						(				self	:str):



          """simple docstring"""

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





       def 				UpperCamelCase__						(				self	:Any,      snake_case	:int,      snake_case	:int):



          """simple docstring"""

          if from_vertex in self.vertex:
             self.vertex[from_vertex].append(snake_case)
          else:
             # else make a new vertex
             _lowercase              =[to_vertex]





       def 				UpperCamelCase__						(				self	:Union[str, Any]):



          """simple docstring"""

          _lowercase              =[False] * len(self.vertex)

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





       def 				UpperCamelCase__						(				self	:List[str],      snake_case	:int,      snake_case	:list):



          """simple docstring"""

          _lowercase              =True

          print(snake_case,      end=' ')

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


if __name__ == "__main__":
    _SCREAMING_SNAKE_CASE   =  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


