


'''simple docstring'''






def lowerCamelCase__     (		__lowerCamelCase			:				dict				):







   '''simple docstring'''




   _UpperCAmelCase  :  Optional[int]				       =set()
   # edges = list of graph's edges
   _UpperCAmelCase  :  Dict				       =get_edges(__lowerCamelCase				)

   # While there are still elements in edges list, take an arbitrary edge
   # (from_node, to_node) and add his extremity to chosen_vertices and then
   # remove all arcs adjacent to the from_node and to_node
   while edges:
      _UpperCAmelCase       ,			_UpperCAmelCase  :  Dict				       =edges.pop()
      chosen_vertices.add(__lowerCamelCase				)
      chosen_vertices.add(__lowerCamelCase				)
      for edge in edges.copy():
         if from_node in edge or to_node in edge:
            edges.discard(__lowerCamelCase				)
   return chosen_vertices





def lowerCamelCase__     (		__lowerCamelCase			:				dict				):







   '''simple docstring'''




   _UpperCAmelCase  :  Union[str, Any]				       =set()
   for from_node, to_nodes in graph.items():
      for to_node in to_nodes:
         edges.add((from_node, to_node)				)
   return edges


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 # graph = {0: [1, 3], 1: [0, 3], 2: [0, 3, 4], 3: [0, 1, 2], 4: [2, 3]}
 # print(f"Matching vertex cover:\n{matching_min_vertex_cover(graph)}")





'''simple docstring'''






from typing import Any

import numpy as np





def lowerCamelCase__     (		__lowerCamelCase			:				np.ndarray				):







   '''simple docstring'''




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





def lowerCamelCase__     (		__lowerCamelCase			:				np.ndarray			,       __lowerCamelCase			:				np.ndarray				):







   '''simple docstring'''




   _UpperCAmelCase  :  str				       =v.conjugate().T
   _UpperCAmelCase  :  Optional[int]				       =v_star.dot(__lowerCamelCase				)
   assert isinstance(__lowerCamelCase			,       np.ndarray				)
   return (v_star_dot.dot(__lowerCamelCase				)) / (v_star.dot(__lowerCamelCase				))





def lowerCamelCase__     (		):







   '''simple docstring'''




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

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


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 tests()

