

__UpperCAmelCase      = [
    ["""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 	snake_case_      (__A     :						str     )			->	Tuple:
   __lowerCAmelCase  :			int					    =						set()
   for row in edge_array:
      for item in row:
         distinct_edge.add(item[0]     )
   return list(__A     )





def 	snake_case_      (__A     :						Dict					,   __A     :						str     )			->	Tuple:
   __lowerCAmelCase  :			Optional[int]					    =						["""0"""] * len(__A     )
   for i, row in enumerate(__A     ):
      for item in row:
         if distinct_edge in item[0]:
            __lowerCAmelCase  :			Union[str, Any]					    =						"""1"""
            break
   return "".join(__A     )





def 	snake_case_      (__A     :						Union[str, Any]     )			->	List[str]:
   __lowerCAmelCase  :			Dict					    =						get_distinct_edge(__A     )
   __lowerCAmelCase  :			Union[str, Any]					    =						{}

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





def 	snake_case_      (__A     :						Dict     )			->	Dict:
   __lowerCAmelCase  :			Optional[Any]					    =						{}
   for _, item in enumerate(__A     ):
      nodes.setdefault(item[2]					,   []     ).append(item[0]     )
   return nodes





def 	snake_case_      (__A     :						List[str]     )			->	Union[str, Any]:
   __lowerCAmelCase  :			Tuple					    =						{}
   for key, value in nodes.items():
      __lowerCAmelCase  :			Any					    =						value
   return cluster





def 	snake_case_      (__A     :						str     )			->	List[str]:
   return [i * 1_0_0 / len(__A     ) for i in cluster]





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





def 	snake_case_      (__A     :						List[str]					,   __A     :						int					,   __A     :						Union[str, Any]					,   __A     :						str     )			->	str:
   for i in cluster[ca]:
      __lowerCAmelCase  :			Tuple					    =						0
      __lowerCAmelCase  :			Optional[int]					    =						ca + 1
      while ca < max(cluster.keys()     ):
         for j in cluster[ca]:
            if int(__A					,   2     ) & int(__A					,   2     ) == int(__A					,   2     ):
               if tuple(nodes[i]     ) in graph:
                  graph[tuple(nodes[i]     )].append(nodes[j]     )
               else:
                  __lowerCAmelCase  :			Any					    =						[nodes[j]]
               count += 1
         if count == 0:
            __lowerCAmelCase  :			List[str]					    =						ca + 1
         else:
            break





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





def 	snake_case_      (__A     :						Optional[Any]					,   __A     :						List[str]					,   __A     :						List[str]					,   __A     :						int=None     )			->	Any:
   __lowerCAmelCase  :			str					    =						(path or []) + [start]
   if start == end:
      paths.append(__A     )
   for node in graph[start]:
      if tuple(__A     ) not in path:
         my_dfs(__A					,   tuple(__A     )					,   __A					,   __A     )





def 	snake_case_      (__A     :						List[Any]					,   __A     :						List[Any]					,   __A     :						Optional[int]     )			->	List[str]:
   __lowerCAmelCase  :			Union[str, Any]					    =						int(s / 1_0_0 * (len(__A     ) - 1)     )
   for i in cluster[k]:
      my_dfs(__A					,   tuple(cluster[k][i]     )					,   (["""Header"""],)     )





def 	snake_case_      (__A     :						str     )			->	Tuple:
   __lowerCAmelCase  :			Tuple					    =						[]
   for edges in paths:
      __lowerCAmelCase  :			Tuple					    =						[]
      for j in range(len(__A     ) - 1     ):
         __lowerCAmelCase  :			Tuple					    =						list(edges[j]     )
         for e in temp:
            __lowerCAmelCase  :			int					    =						(e[0], e[1])
            el.append(__A     )
      freq_sub_el.append(__A     )
   return freq_sub_el





def 	snake_case_      (__A     :						Optional[int]     )			->	Any:
   for i in range(len(__A     )     ):
      for j in range(len(edge_array[i]     )     ):
         __lowerCAmelCase  :			Union[str, Any]					    =						edge_array[i][j].split("""-"""     )
         __lowerCAmelCase  :			List[str]					    =						t


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





from .prime_check import Test

Test()


