


__lowerCamelCase   	=  [
    ['''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 			_a      (    __UpperCamelCase			):
     a_     :  List[Any]				      =     set()
     for row in edge_array:
          for item in row:
               distinct_edge.add(item[0]			)
     return list(__UpperCamelCase			)



def 			_a      (    __UpperCamelCase	,	__UpperCamelCase			):
     a_     :  Optional[Any]				      =     ["""0"""] * len(__UpperCamelCase			)
     for i, row in enumerate(__UpperCamelCase			):
          for item in row:
               if distinct_edge in item[0]:
                    a_     :  Union[str, Any]				      =     """1"""
                    break
     return "".join(__UpperCamelCase			)



def 			_a      (    __UpperCamelCase			):
     a_     :  str				      =     get_distinct_edge(__UpperCamelCase			)
     a_     :  Dict				      =     {}

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



def 			_a      (    __UpperCamelCase			):
     a_     :  Optional[Any]				      =     {}
     for _, item in enumerate(__UpperCamelCase			):
          nodes.setdefault(item[2]	,	[]			).append(item[0]			)
     return nodes



def 			_a      (    __UpperCamelCase			):
     a_     :  Dict				      =     {}
     for key, value in nodes.items():
          a_     :  Union[str, Any]				      =     value
     return cluster



def 			_a      (    __UpperCamelCase			):
     return [i * 1_0_0 / len(__UpperCamelCase			) for i in cluster]



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



def 			_a      (    __UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase			):
     for i in cluster[ca]:
          a_     :  Any				      =     0
          a_     :  Optional[int]				      =     ca + 1
          while ca < max(cluster.keys()			):
               for j in cluster[ca]:
                    if int(__UpperCamelCase	,	2			) & int(__UpperCamelCase	,	2			) == int(__UpperCamelCase	,	2			):
                         if tuple(nodes[i]			) in graph:
                              graph[tuple(nodes[i]			)].append(nodes[j]			)
                         else:
                              a_     :  Tuple				      =     [nodes[j]]
                         count += 1
               if count == 0:
                    a_     :  Optional[int]				      =     ca + 1
               else:
                    break



def 			_a      (    __UpperCamelCase	,	__UpperCamelCase			):
     a_     :  Tuple				      =     cluster[max(cluster.keys()			)]
     a_     :  List[str]				      =     """Header"""
     a_     :  int				      =     {}
     for i in x:
          if (["Header"],) in graph:
               graph[(["Header"],)].append(x[i]			)
          else:
               a_     :  List[str]				      =     [x[i]]
     for i in x:
          a_     :  Optional[Any]				      =     [["""Header"""]]
     a_     :  Optional[Any]				      =     1
     while i < max(__UpperCamelCase			) - 1:
          create_edge(__UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase			)
          a_     :  str				      =     i + 1
     return graph



def 			_a      (    __UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase=None			):
     a_     :  Optional[int]				      =     (path or []) + [start]
     if start == end:
          paths.append(__UpperCamelCase			)
     for node in graph[start]:
          if tuple(__UpperCamelCase			) not in path:
               my_dfs(__UpperCamelCase	,	tuple(__UpperCamelCase			)	,	__UpperCamelCase	,	__UpperCamelCase			)



def 			_a      (    __UpperCamelCase	,	__UpperCamelCase	,	__UpperCamelCase			):
     a_     :  List[str]				      =     int(s / 1_0_0 * (len(__UpperCamelCase			) - 1)			)
     for i in cluster[k]:
          my_dfs(__UpperCamelCase	,	tuple(cluster[k][i]			)	,	(["""Header"""],)			)



def 			_a      (    __UpperCamelCase			):
     a_     :  Union[str, Any]				      =     []
     for edges in paths:
          a_     :  Optional[Any]				      =     []
          for j in range(len(__UpperCamelCase			) - 1			):
               a_     :  Union[str, Any]				      =     list(edges[j]			)
               for e in temp:
                    a_     :  Optional[Any]				      =     (e[0], e[1])
                    el.append(__UpperCamelCase			)
          freq_sub_el.append(__UpperCamelCase			)
     return freq_sub_el



def 			_a      (    __UpperCamelCase			):
     for i in range(len(__UpperCamelCase			)			):
          for j in range(len(edge_array[i]			)			):
               a_     :  Union[str, Any]				      =     edge_array[i][j].split("""-"""			)
               a_     :  int				      =     t


if __name__ == "__main__":
       preprocess(edge_array)
       __lowerCamelCase   	=  get_frequency_table(edge_array)
       __lowerCamelCase   	=  get_nodes(frequency_table)
       __lowerCamelCase   	=  get_cluster(nodes)
       __lowerCamelCase   	=  get_support(cluster)
       __lowerCamelCase   	=  construct_graph(cluster, nodes)
       find_freq_subgraph_given_support(60, cluster, graph)
       __lowerCamelCase   	=  []
       __lowerCamelCase   	=  freq_subgraphs_edge_list(paths)
       print_all()





"""simple docstring"""
import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput




@dataclass
class  _snake_case	(    _lowercase							):
							SCREAMING_SNAKE_CASE		  =    42
							SCREAMING_SNAKE_CASE		  =    None
							SCREAMING_SNAKE_CASE		  =    None






class  _snake_case	(    unittest.TestCase							):






							def 				__lowercase	(       self    :      Optional[Any]     ):






												"""simple docstring"""



												__a:    Dict		     =       ModelOutputTest(a=3_0     )
												self.assertEqual(x.a    ,			3_0     )
												self.assertIsNone(x.b     )
												self.assertIsNone(x.c     )
												with self.assertRaises(snake_case__     ):
																	__a:    int		     =       x.d






							def 				__lowercase	(       self    :      int     ):






												"""simple docstring"""



												__a:    Tuple		     =       ModelOutputTest(a=3_0    ,			b=1_0     )
												self.assertEqual(x[0]    ,			3_0     )
												self.assertEqual(x[1]    ,			1_0     )
												self.assertEqual(x[:2]    ,			(3_0, 1_0)     )
												self.assertEqual(x[:]    ,			(3_0, 1_0)     )

												__a:    Tuple		     =       ModelOutputTest(a=3_0    ,			c=1_0     )
												self.assertEqual(x[0]    ,			3_0     )
												self.assertEqual(x[1]    ,			1_0     )
												self.assertEqual(x[:2]    ,			(3_0, 1_0)     )
												self.assertEqual(x[:]    ,			(3_0, 1_0)     )






							def 				__lowercase	(       self    :      Tuple     ):






												"""simple docstring"""



												__a:    List[str]		     =       ModelOutputTest(a=3_0    ,			b=1_0     )
												self.assertEqual(x["""a"""]    ,			3_0     )
												self.assertEqual(x["""b"""]    ,			1_0     )
												with self.assertRaises(snake_case__     ):
																	__a:    Union[str, Any]		     =       x["""c"""]

												__a:    str		     =       ModelOutputTest(a=3_0    ,			c=1_0     )
												self.assertEqual(x["""a"""]    ,			3_0     )
												self.assertEqual(x["""c"""]    ,			1_0     )
												with self.assertRaises(snake_case__     ):
																	__a:    List[str]		     =       x["""b"""]






							def 				__lowercase	(       self    :      List[str]     ):






												"""simple docstring"""



												__a:    str		     =       ModelOutputTest(a=3_0     )
												self.assertEqual(list(x.keys()     )    ,			["""a"""]     )
												self.assertEqual(list(x.values()     )    ,			[3_0]     )
												self.assertEqual(list(x.items()     )    ,			[("""a""", 3_0)]     )
												self.assertEqual(list(snake_case__     )    ,			["""a"""]     )

												__a:    Optional[Any]		     =       ModelOutputTest(a=3_0    ,			b=1_0     )
												self.assertEqual(list(x.keys()     )    ,			["""a""", """b"""]     )
												self.assertEqual(list(x.values()     )    ,			[3_0, 1_0]     )
												self.assertEqual(list(x.items()     )    ,			[("""a""", 3_0), ("""b""", 1_0)]     )
												self.assertEqual(list(snake_case__     )    ,			["""a""", """b"""]     )

												__a:    Union[str, Any]		     =       ModelOutputTest(a=3_0    ,			c=1_0     )
												self.assertEqual(list(x.keys()     )    ,			["""a""", """c"""]     )
												self.assertEqual(list(x.values()     )    ,			[3_0, 1_0]     )
												self.assertEqual(list(x.items()     )    ,			[("""a""", 3_0), ("""c""", 1_0)]     )
												self.assertEqual(list(snake_case__     )    ,			["""a""", """c"""]     )

												with self.assertRaises(snake_case__     ):
																	__a:    List[Any]		     =       x.update({"""d""": 2_0}     )
												with self.assertRaises(snake_case__     ):
																	del x["a"]
												with self.assertRaises(snake_case__     ):
																	__a:    Union[str, Any]		     =       x.pop("""a"""     )
												with self.assertRaises(snake_case__     ):
																	__a:    List[Any]		     =       x.setdefault("""d"""    ,			3_2     )






							def 				__lowercase	(       self    :      Any     ):






												"""simple docstring"""



												__a:    List[str]		     =       ModelOutputTest(a=3_0     )
												__a:    str		     =       1_0
												self.assertEqual(x.a    ,			1_0     )
												self.assertEqual(x["""a"""]    ,			1_0     )






							def 				__lowercase	(       self    :      Dict     ):






												"""simple docstring"""



												__a:    List[str]		     =       ModelOutputTest(a=3_0     )
												__a:    Any		     =       1_0
												self.assertEqual(x.a    ,			1_0     )
												self.assertEqual(x["""a"""]    ,			1_0     )






							def 				__lowercase	(       self    :      int     ):






												"""simple docstring"""



												__a:    List[Any]		     =       ModelOutputTest({"""a""": 3_0, """b""": 1_0}     )
												self.assertEqual(list(x.keys()     )    ,			["""a""", """b"""]     )
												self.assertEqual(x.a    ,			3_0     )
												self.assertEqual(x.b    ,			1_0     )






							def 				__lowercase	(       self    :      List[str]     ):






												"""simple docstring"""



												__a:    Union[str, Any]		     =       ModelOutputTest([("""a""", 3_0), ("""b""", 1_0)]     )
												self.assertEqual(list(x.keys()     )    ,			["""a""", """b"""]     )
												self.assertEqual(x.a    ,			3_0     )
												self.assertEqual(x.b    ,			1_0     )

												with self.assertRaises(snake_case__     ):
																	__a:    str		     =       ModelOutputTest([("""a""", 3_0), (1_0, 1_0)]     )

												__a:    str		     =       ModelOutputTest(a=(3_0, 3_0)     )
												self.assertEqual(list(x.keys()     )    ,			["""a"""]     )
												self.assertEqual(x.a    ,			(3_0, 3_0)     )
