




"""simple docstring"""

class        lowercase      :







				def __init__(							self   :					Optional[Any]       ):



					"""simple docstring"""

					A_  :				Dict	   =		{}







				def 					a_  (							self   :					Optional[int]       ):



					"""simple docstring"""

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







				def 					a_  (							self   :					Optional[int]      ,     _lowerCamelCase   :					int      ,     _lowerCamelCase   :					int       ):



					"""simple docstring"""

					if from_vertex in self.vertex:
						self.vertex[from_vertex].append(_lowerCamelCase       )
					else:
						# else make a new vertex
						A_  :				int	   =		[to_vertex]







				def 					a_  (							self   :					Tuple       ):



					"""simple docstring"""

					A_  :				Union[str, Any]	   =		[False] * len(self.vertex       )

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







				def 					a_  (							self   :					str      ,     _lowerCamelCase   :					int      ,     _lowerCamelCase   :					list       ):



					"""simple docstring"""

					A_  :				Union[str, Any]	   =		True

					print(_lowerCamelCase      ,     end=''' '''       )

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


if __name__ == "__main__":
		_lowerCamelCase  :			Tuple        =       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 typing import Any

import numpy as np

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	return np.array_equal(_UpperCAmelCase  ,      matrix.conjugate().T	)

def 		lowercase_      (		_UpperCAmelCase  ,      _UpperCAmelCase	):




	"""simple docstring"""






	A_  :				Tuple	   =		v.conjugate().T
	A_  :				Tuple	   =		v_star.dot(_UpperCAmelCase	)
	assert isinstance(_UpperCAmelCase  ,      np.ndarray	)
	return (v_star_dot.dot(_UpperCAmelCase	)) / (v_star.dot(_UpperCAmelCase	))

def 		lowercase_      (		):




	"""simple docstring"""






	A_  :				Optional[Any]	   =		np.array([[2, 2 + 1J, 4], [2 - 1J, 3, 1J], [4, -1J, 1]]	)
	A_  :				str	   =		np.array([[1], [2], [3]]	)
	assert is_hermitian(_UpperCAmelCase	), f"""{a} is not hermitian."""
	print(rayleigh_quotient(_UpperCAmelCase  ,      _UpperCAmelCase	)	)

	A_  :				int	   =		np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]	)
	assert is_hermitian(_UpperCAmelCase	), f"""{a} is not hermitian."""
	assert rayleigh_quotient(_UpperCAmelCase  ,      _UpperCAmelCase	) == float(3	)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		tests()





