






'''simple docstring'''




__SCREAMING_SNAKE_CASE	:					Any					=  [
    ['''ab-e1''', '''ac-e3''', '''ad-e5''', '''bc-e4''', '''bd-e2''', '''be-e6''', '''bh-e12''', '''cd-e2''', '''ce-e4''',
     '''de-e1''', '''df-e8''', '''dg-e5''', '''dh-e10''', '''ef-e3''', '''eg-e2''', '''fg-e6''', '''gh-e6''', '''hi-e3'''],
    ['''ab-e1''', '''ac-e3''', '''ad-e5''', '''bc-e4''', '''bd-e2''', '''be-e6''', '''cd-e2''', '''de-e1''', '''df-e8''',
     '''ef-e3''', '''eg-e2''', '''fg-e6'''],
    ['''ab-e1''', '''ac-e3''', '''bc-e4''', '''bd-e2''', '''de-e1''', '''df-e8''', '''dg-e5''', '''ef-e3''', '''eg-e2''',
     '''eh-e12''', '''fg-e6''', '''fh-e10''', '''gh-e6'''],
    ['''ab-e1''', '''ac-e3''', '''bc-e4''', '''bd-e2''', '''bh-e12''', '''cd-e2''', '''df-e8''', '''dh-e10'''],
    ['''ab-e1''', '''ac-e3''', '''ad-e5''', '''bc-e4''', '''bd-e2''', '''cd-e2''', '''ce-e4''', '''de-e1''', '''df-e8''',
     '''dg-e5''', '''ef-e3''', '''eg-e2''', '''fg-e6''']
]

def      UpperCamelCase_							( _UpperCAmelCase  :				Optional[int]   )   ->   List[str]:


       """simple docstring"""







       _UpperCAmelCase					:  int											=   set()
       for row in edge_array:
              for item in row:
                     distinct_edge.add(item[0]   )
       return list(snake_case__   )

def      UpperCamelCase_							( _UpperCAmelCase  :				Optional[int]      ,     _UpperCAmelCase  :				Optional[Any]   )   ->   List[Any]:


       """simple docstring"""







       _UpperCAmelCase					:  Optional[Any]											=   ["0"] * len(snake_case__   )
       for i, row in enumerate(snake_case__   ):
              for item in row:
                     if distinct_edge in item[0]:
                            _UpperCAmelCase					:  Dict											=   "1"
                            break
       return "".join(snake_case__   )

def      UpperCamelCase_							( _UpperCAmelCase  :				int   )   ->   int:


       """simple docstring"""







       _UpperCAmelCase					:  Dict											=   get_distinct_edge(snake_case__   )
       _UpperCAmelCase					:  str											=   {}

       for item in distinct_edge:
              _UpperCAmelCase					:  Optional[Any]											=   get_bitcode(snake_case__      ,     snake_case__   )
              # print('bit',bit)
              # bt=''.join(bit)
              _UpperCAmelCase					:  int											=   bit.count("1"   )
              _UpperCAmelCase					:  int											=   [s, bit]
       # Store [Distinct edge, WT(Bitcode), Bitcode] in descending order
       _UpperCAmelCase					:  Optional[int]											=   [
           [k, v[0], v[1]]
           for k, v in sorted(frequency_table.items()      ,     key=lambda _UpperCAmelCase   : v[1][0]      ,     reverse=snake_case__   )
       ]
       return sorted_frequency_table

def      UpperCamelCase_							( _UpperCAmelCase  :				List[str]   )   ->   Optional[int]:


       """simple docstring"""







       _UpperCAmelCase					:  Union[str, Any]											=   {}
       for _, item in enumerate(snake_case__   ):
              nodes.setdefault(item[2]      ,     []   ).append(item[0]   )
       return nodes

def      UpperCamelCase_							( _UpperCAmelCase  :				List[Any]   )   ->   Tuple:


       """simple docstring"""







       _UpperCAmelCase					:  List[str]											=   {}
       for key, value in nodes.items():
              _UpperCAmelCase					:  Tuple											=   value
       return cluster

def      UpperCamelCase_							( _UpperCAmelCase  :				int   )   ->   Tuple:


       """simple docstring"""







       return [i * 100 / len(snake_case__   ) for i in cluster]

def      UpperCamelCase_							( )   ->   None:


       """simple docstring"""







       print("\nNodes\n"   )
       for key, value in nodes.items():
              print(snake_case__      ,     snake_case__   )
       print("\nSupport\n"   )
       print(snake_case__   )
       print("\n Cluster \n"   )
       for key, value in sorted(cluster.items()      ,     reverse=snake_case__   ):
              print(snake_case__      ,     snake_case__   )
       print("\n Graph\n"   )
       for key, value in graph.items():
              print(snake_case__      ,     snake_case__   )
       print("\n Edge List of Frequent subgraphs \n"   )
       for edge_list in freq_subgraph_edge_list:
              print(snake_case__   )

def      UpperCamelCase_							( _UpperCAmelCase  :				Union[str, Any]      ,     _UpperCAmelCase  :				int      ,     _UpperCAmelCase  :				int      ,     _UpperCAmelCase  :				Optional[Any]   )   ->   str:


       """simple docstring"""







       for i in cluster[ca]:
              _UpperCAmelCase					:  str											=   0
              _UpperCAmelCase					:  List[Any]											=   ca + 1
              while ca < max(cluster.keys()   ):
                     for j in cluster[ca]:
                            if int(snake_case__      ,     2   ) & int(snake_case__      ,     2   ) == int(snake_case__      ,     2   ):
                                   if tuple(nodes[i]   ) in graph:
                                          graph[tuple(nodes[i]   )].append(nodes[j]   )
                                   else:
                                          _UpperCAmelCase					:  List[str]											=   [nodes[j]]
                                   count += 1
                     if count == 0:
                            _UpperCAmelCase					:  str											=   ca + 1
                     else:
                            break

def      UpperCamelCase_							( _UpperCAmelCase  :				str      ,     _UpperCAmelCase  :				Optional[int]   )   ->   Tuple:


       """simple docstring"""







       _UpperCAmelCase					:  str											=   cluster[max(cluster.keys()   )]
       _UpperCAmelCase					:  Dict											=   "Header"
       _UpperCAmelCase					:  Optional[Any]											=   {}
       for i in x:
              if (["Header"],) in graph:
                     graph[(["Header"],)].append(x[i]   )
              else:
                     _UpperCAmelCase					:  Any											=   [x[i]]
       for i in x:
              _UpperCAmelCase					:  Optional[Any]											=   [["Header"]]
       _UpperCAmelCase					:  Any											=   1
       while i < max(snake_case__   ) - 1:
              create_edge(snake_case__      ,     snake_case__      ,     snake_case__      ,     snake_case__   )
              _UpperCAmelCase					:  List[Any]											=   i + 1
       return graph

def      UpperCamelCase_							( _UpperCAmelCase  :				str      ,     _UpperCAmelCase  :				Dict      ,     _UpperCAmelCase  :				Optional[Any]      ,     _UpperCAmelCase  :				List[Any]=None   )   ->   Union[str, Any]:


       """simple docstring"""







       _UpperCAmelCase					:  Dict											=   (path or []) + [start]
       if start == end:
              paths.append(snake_case__   )
       for node in graph[start]:
              if tuple(snake_case__   ) not in path:
                     my_dfs(snake_case__      ,     tuple(snake_case__   )      ,     snake_case__      ,     snake_case__   )

def      UpperCamelCase_							( _UpperCAmelCase  :				Optional[int]      ,     _UpperCAmelCase  :				int      ,     _UpperCAmelCase  :				Optional[Any]   )   ->   str:


       """simple docstring"""







       _UpperCAmelCase					:  str											=   int(s / 100 * (len(snake_case__   ) - 1)   )
       for i in cluster[k]:
              my_dfs(snake_case__      ,     tuple(cluster[k][i]   )      ,     (["Header"],)   )

def      UpperCamelCase_							( _UpperCAmelCase  :				Dict   )   ->   int:


       """simple docstring"""







       _UpperCAmelCase					:  Dict											=   []
       for edges in paths:
              _UpperCAmelCase					:  int											=   []
              for j in range(len(snake_case__   ) - 1   ):
                     _UpperCAmelCase					:  int											=   list(edges[j]   )
                     for e in temp:
                            _UpperCAmelCase					:  Optional[int]											=   (e[0], e[1])
                            el.append(snake_case__   )
              freq_sub_el.append(snake_case__   )
       return freq_sub_el

def      UpperCamelCase_							( _UpperCAmelCase  :				Any   )   ->   List[str]:


       """simple docstring"""







       for i in range(len(snake_case__   )   ):
              for j in range(len(edge_array[i]   )   ):
                     _UpperCAmelCase					:  Union[str, Any]											=   edge_array[i][j].split("-"   )
                     _UpperCAmelCase					:  Optional[int]											=   t


if __name__ == "__main__":
  preprocess(edge_array)
  __SCREAMING_SNAKE_CASE	:					List[Any]					=  get_frequency_table(edge_array)
  __SCREAMING_SNAKE_CASE	:					Any					=  get_nodes(frequency_table)
  __SCREAMING_SNAKE_CASE	:					Tuple					=  get_cluster(nodes)
  __SCREAMING_SNAKE_CASE	:					int					=  get_support(cluster)
  __SCREAMING_SNAKE_CASE	:					Optional[int]					=  construct_graph(cluster, nodes)
  find_freq_subgraph_given_support(60, cluster, graph)
  __SCREAMING_SNAKE_CASE	:					list					=  []
  __SCREAMING_SNAKE_CASE	:					Optional[int]					=  freq_subgraphs_edge_list(paths)
  print_all()


'''simple docstring'''




from sklearn.metrics import accuracy_score

import datasets


__SCREAMING_SNAKE_CASE	:					Optional[int]					=  """
Accuracy is the proportion of correct predictions among the total number of cases processed. It can be computed with:
Accuracy = (TP + TN) / (TP + TN + FP + FN)
 Where:
TP: True positive
TN: True negative
FP: False positive
FN: False negative
"""


__SCREAMING_SNAKE_CASE	:					Any					=  """
Args:
    predictions (`list` of `int`): Predicted labels.
    references (`list` of `int`): Ground truth labels.
    normalize (`boolean`): If set to False, returns the number of correctly classified samples. Otherwise, returns the fraction of correctly classified samples. Defaults to True.
    sample_weight (`list` of `float`): Sample weights Defaults to None.

Returns:
    accuracy (`float` or `int`): Accuracy score. Minimum possible value is 0. Maximum possible value is 1.0, or the number of examples input, if `normalize` is set to `True`.. A higher score means higher accuracy.

Examples:

    Example 1-A simple example
        >>> accuracy_metric = datasets.load_metric(\"accuracy\")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0])
        >>> print(results)
        {'accuracy': 0.5}

    Example 2-The same as Example 1, except with `normalize` set to `False`.
        >>> accuracy_metric = datasets.load_metric(\"accuracy\")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], normalize=False)
        >>> print(results)
        {'accuracy': 3.0}

    Example 3-The same as Example 1, except with `sample_weight` set.
        >>> accuracy_metric = datasets.load_metric(\"accuracy\")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], sample_weight=[0.5, 2, 0.7, 0.5, 9, 0.4])
        >>> print(results)
        {'accuracy': 0.8778625954198473}
"""


__SCREAMING_SNAKE_CASE	:					Optional[int]					=  """
@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      lowerCamelCase_     (datasets.Metric   ):
      '''simple docstring'''

      def 					_A     (	self						:    int	):
             return datasets.MetricInfo(
                 description=_DESCRIPTION						, citation=_CITATION						, inputs_description=_KWARGS_DESCRIPTION						, features=datasets.Features(
                     {
                         "predictions": datasets.Sequence(datasets.Value("int32"	)	),
                         "references": datasets.Sequence(datasets.Value("int32"	)	),
                     }
                     if self.config_name == "multilabel"
                     else {
                         "predictions": datasets.Value("int32"	),
                         "references": datasets.Value("int32"	),
                     }	)						, reference_urls=["https://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html"]						, )





      def 					_A     (	self						:    str						, A						:    List[str]						, A						:    int						, A						:    List[Any]=True						, A						:    List[str]=None	):
             return {
                 "accuracy": float(
                     accuracy_score(A						, A						, normalize=A						, sample_weight=A	)	)
             }

