


"""simple docstring"""







from collections import deque
from math import floor
from random import random
from time import time






class       __A				:






 """simple docstring"""




 def __init__(		self						)					->     Tuple:
     a 		={}


 def       SCREAMING_SNAKE_CASE							(		self ,    __A ,    __A ,    __A=1						)					->     Union[str, Any]:
     if self.graph.get(__A						):
         if self.graph[u].count([w, v]						) == 0:
             self.graph[u].append([w, v]						)
     else:
         a 		=[[w, v]]
     if not self.graph.get(__A						):
         a 		=[]


 def       SCREAMING_SNAKE_CASE							(		self						)					->     int:
     return list(self.graph						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A ,    __A						)					->     Optional[Any]:
     if self.graph.get(__A						):
         for _ in self.graph[u]:
             if _[1] == v:
                 self.graph[u].remove(__A						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2 ,    __A=-1						)					->     List[Any]:
     if s == d:
         return []
     a 		=[]
     a 		=[]
     if s == -2:
         a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=s

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if visited.count(node[1]						) < 1:
                     if node[1] == d:
                         visited.append(__A						)
                         return visited
                     else:
                         stack.append(node[1]						)
                         visited.append(node[1]						)
                         a 		=node[1]
                         break

            # check if all the children are visited
         if s == ss:
             stack.pop()
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return visited


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-1						)					->     int:
     if c == -1:
         a 		=floor(random() * 1_0000						) + 10
     for i in range(__A						):
         # every vertex has max 100 edges
         for _ in range(floor(random() * 102						) + 1						):
             a 		=floor(random() * c						) + 1
             if n != i:
                 self.add_pair(__A ,    __A ,    1						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2						)					->     List[str]:
     a 		=deque()
     a 		=[]
     if s == -2:
         a 		=list(self.graph						)[0]
     d.append(__A						)
     visited.append(__A						)
     while d:
         a 		=d.popleft()
         if len(self.graph[s]						) != 0:
             for node in self.graph[s]:
                 if visited.count(node[1]						) < 1:
                     d.append(node[1]						)
                     visited.append(node[1]						)
     return visited


 def       SCREAMING_SNAKE_CASE							(		self ,    __A						)					->     Optional[Any]:
     a 		=0
     for x in self.graph:
         for y in self.graph[x]:
             if y[1] == u:
                 count += 1
     return count


 def       SCREAMING_SNAKE_CASE							(		self ,    __A						)					->     Tuple:
     return len(self.graph[u]						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2						)					->     List[Any]:
     a 		=[]
     a 		=[]
     if s == -2:
         a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=s
     a 		=[]

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if visited.count(node[1]						) < 1:
                     stack.append(node[1]						)
                     visited.append(node[1]						)
                     a 		=node[1]
                     break

            # check if all the children are visited
         if s == ss:
             sorted_nodes.append(stack.pop()						)
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return sorted_nodes


 def       SCREAMING_SNAKE_CASE							(		self						)					->     List[Any]:
     a 		=[]
     a 		=[]
     a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=-2
     a 		=[]
     a 		=s
     a 		=False
     a 		=set()

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if (
                     visited.count(node[1]						) > 0
                     and node[1] != parent
                     and indirect_parents.count(node[1]						) > 0
                     and not on_the_way_back
                 ):
                     a 		=len(__A						) - 1
                     while len_stack >= 0:
                         if stack[len_stack] == node[1]:
                             anticipating_nodes.add(node[1]						)
                             break
                         else:
                             anticipating_nodes.add(stack[len_stack]						)
                             len_stack -= 1
                 if visited.count(node[1]						) < 1:
                     stack.append(node[1]						)
                     visited.append(node[1]						)
                     a 		=node[1]
                     break

            # check if all the children are visited
         if s == ss:
             stack.pop()
             a 		=True
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=False
             indirect_parents.append(__A						)
             a 		=s
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return list(__A						)


 def       SCREAMING_SNAKE_CASE							(		self						)					->     Tuple:
     a 		=[]
     a 		=[]
     a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=-2
     a 		=[]
     a 		=s
     a 		=False
     a 		=set()

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if (
                     visited.count(node[1]						) > 0
                     and node[1] != parent
                     and indirect_parents.count(node[1]						) > 0
                     and not on_the_way_back
                 ):
                     a 		=len(__A						) - 1
                     while len_stack_minus_one >= 0:
                         if stack[len_stack_minus_one] == node[1]:
                             anticipating_nodes.add(node[1]						)
                             break
                         else:
                             return True
                 if visited.count(node[1]						) < 1:
                     stack.append(node[1]						)
                     visited.append(node[1]						)
                     a 		=node[1]
                     break

            # check if all the children are visited
         if s == ss:
             stack.pop()
             a 		=True
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=False
             indirect_parents.append(__A						)
             a 		=s
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return False


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2 ,    __A=-1						)					->     List[str]:
     a 		=time()
     self.dfs(__A ,    __A						)
     a 		=time()
     return end - begin





 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2						)					->     int:
     a 		=time()
     self.bfs(__A						)
     a 		=time()
     return end - begin






class       __A				:






 """simple docstring"""




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


 def       SCREAMING_SNAKE_CASE							(		self ,    __A ,    __A ,    __A=1						)					->     Dict:
     # check if the u exists
     if self.graph.get(__A						):
         # if there already is a edge
         if self.graph[u].count([w, v]						) == 0:
             self.graph[u].append([w, v]						)
     else:
         # if u does not exist
         a 		=[[w, v]]
     # add the other way
     if self.graph.get(__A						):
         # if there already is a edge
         if self.graph[v].count([w, u]						) == 0:
             self.graph[v].append([w, u]						)
     else:
         # if u does not exist
         a 		=[[w, u]]


 def       SCREAMING_SNAKE_CASE							(		self ,    __A ,    __A						)					->     Any:
     if self.graph.get(__A						):
         for _ in self.graph[u]:
             if _[1] == v:
                 self.graph[u].remove(__A						)
        # the other way round
     if self.graph.get(__A						):
         for _ in self.graph[v]:
             if _[1] == u:
                 self.graph[v].remove(__A						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2 ,    __A=-1						)					->     int:
     if s == d:
         return []
     a 		=[]
     a 		=[]
     if s == -2:
         a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=s

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if visited.count(node[1]						) < 1:
                     if node[1] == d:
                         visited.append(__A						)
                         return visited
                     else:
                         stack.append(node[1]						)
                         visited.append(node[1]						)
                         a 		=node[1]
                         break

            # check if all the children are visited
         if s == ss:
             stack.pop()
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return visited


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-1						)					->     List[Any]:
     if c == -1:
         a 		=floor(random() * 1_0000						) + 10
     for i in range(__A						):
         # every vertex has max 100 edges
         for _ in range(floor(random() * 102						) + 1						):
             a 		=floor(random() * c						) + 1
             if n != i:
                 self.add_pair(__A ,    __A ,    1						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2						)					->     str:
     a 		=deque()
     a 		=[]
     if s == -2:
         a 		=list(self.graph						)[0]
     d.append(__A						)
     visited.append(__A						)
     while d:
         a 		=d.popleft()
         if len(self.graph[s]						) != 0:
             for node in self.graph[s]:
                 if visited.count(node[1]						) < 1:
                     d.append(node[1]						)
                     visited.append(node[1]						)
     return visited


 def       SCREAMING_SNAKE_CASE							(		self ,    __A						)					->     str:
     return len(self.graph[u]						)


 def       SCREAMING_SNAKE_CASE							(		self						)					->     List[Any]:
     a 		=[]
     a 		=[]
     a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=-2
     a 		=[]
     a 		=s
     a 		=False
     a 		=set()

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if (
                     visited.count(node[1]						) > 0
                     and node[1] != parent
                     and indirect_parents.count(node[1]						) > 0
                     and not on_the_way_back
                 ):
                     a 		=len(__A						) - 1
                     while len_stack >= 0:
                         if stack[len_stack] == node[1]:
                             anticipating_nodes.add(node[1]						)
                             break
                         else:
                             anticipating_nodes.add(stack[len_stack]						)
                             len_stack -= 1
                 if visited.count(node[1]						) < 1:
                     stack.append(node[1]						)
                     visited.append(node[1]						)
                     a 		=node[1]
                     break

            # check if all the children are visited
         if s == ss:
             stack.pop()
             a 		=True
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=False
             indirect_parents.append(__A						)
             a 		=s
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return list(__A						)


 def       SCREAMING_SNAKE_CASE							(		self						)					->     Optional[Any]:
     a 		=[]
     a 		=[]
     a 		=list(self.graph						)[0]
     stack.append(__A						)
     visited.append(__A						)
     a 		=-2
     a 		=[]
     a 		=s
     a 		=False
     a 		=set()

     while True:
         # check if there is any non isolated nodes
         if len(self.graph[s]						) != 0:
             a 		=s
             for node in self.graph[s]:
                 if (
                     visited.count(node[1]						) > 0
                     and node[1] != parent
                     and indirect_parents.count(node[1]						) > 0
                     and not on_the_way_back
                 ):
                     a 		=len(__A						) - 1
                     while len_stack_minus_one >= 0:
                         if stack[len_stack_minus_one] == node[1]:
                             anticipating_nodes.add(node[1]						)
                             break
                         else:
                             return True
                 if visited.count(node[1]						) < 1:
                     stack.append(node[1]						)
                     visited.append(node[1]						)
                     a 		=node[1]
                     break

            # check if all the children are visited
         if s == ss:
             stack.pop()
             a 		=True
             if len(__A						) != 0:
                 a 		=stack[len(__A						) - 1]
         else:
             a 		=False
             indirect_parents.append(__A						)
             a 		=s
             a 		=ss

         # check if se have reached the starting point
         if len(__A						) == 0:
             return False


 def       SCREAMING_SNAKE_CASE							(		self						)					->     List[Any]:
     return list(self.graph						)


 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2 ,    __A=-1						)					->     Optional[int]:
     a 		=time()
     self.dfs(__A ,    __A						)
     a 		=time()
     return end - begin





 def       SCREAMING_SNAKE_CASE							(		self ,    __A=-2						)					->     Dict:
     a 		=time()
     self.bfs(__A						)
     a 		=time()
     return end - begin

"""simple docstring"""





from sklearn.metrics import matthews_corrcoef

import datasets


_a														=		"""
Compute the Matthews correlation coefficient (MCC)

The Matthews correlation coefficient is used in machine learning as a
measure of the quality of binary and multiclass classifications. It takes
into account true and false positives and negatives and is generally
regarded as a balanced measure which can be used even if the classes are of
very different sizes. The MCC is in essence a correlation coefficient value
between -1 and +1. A coefficient of +1 represents a perfect prediction, 0
an average random prediction and -1 an inverse prediction.  The statistic
is also known as the phi coefficient. [source: Wikipedia]
"""

_a														=		"""
Args:
    predictions (list of int): Predicted labels, as returned by a model.
    references (list of int): Ground truth labels.
    sample_weight (list of int, float, or bool): Sample weights. Defaults to `None`.
Returns:
    matthews_correlation (dict containing float): Matthews correlation.
Examples:
    Example 1, a basic example with only predictions and references as inputs:
        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3])
        >>> print(round(results['matthews_correlation'], 2))
        0.54

    Example 2, the same example as above, but also including sample weights:
        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3],
        ...                                     sample_weight=[0.5, 3, 1, 1, 1, 2])
        >>> print(round(results['matthews_correlation'], 2))
        0.1

    Example 3, the same example as above, but with sample weights that cause a negative correlation:
        >>> matthews_metric = datasets.load_metric(\"matthews_correlation\")
        >>> results = matthews_metric.compute(references=[1, 3, 2, 0, 3, 2],
        ...                                     predictions=[1, 2, 2, 0, 3, 3],
        ...                                     sample_weight=[0.5, 1, 0, 0, 0, 1])
        >>> print(round(results['matthews_correlation'], 2))
        -0.25
"""

_a														=		"""\
@article{scikit-learn,
  title={Scikit-learn: Machine Learning in {P}ython},
  author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
  journal={Journal of Machine Learning Research},
  volume={12},
  pages={2825--2830},
  year={2011}
}
"""






@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION      ,     _KWARGS_DESCRIPTION	)
class     _UpperCAmelCase(    datasets.Metric	):



		def 						UpperCAmelCase							(					self)       ->       List[Any]:






							'''simple docstring'''
							return datasets.MetricInfo(
							    description=_DESCRIPTION				,		citation=_CITATION				,		inputs_description=_KWARGS_DESCRIPTION				,		features=datasets.Features(
							        {
							            '''predictions''': datasets.Value('''int32'''),
							            '''references''': datasets.Value('''int32'''),
							        })				,		reference_urls=[
							        '''https://scikit-learn.org/stable/modules/generated/sklearn.metrics.matthews_corrcoef.html'''
							    ]				,		)




		def 						UpperCAmelCase							(					self				,		__a				,		__a				,		__a=None)       ->       Dict:






							'''simple docstring'''
							return {
							    "matthews_correlation": float(matthews_corrcoef(__a				,		__a				,		sample_weight=__a)),
							}






