

'''simple docstring'''

lowercase__            =     [
    ["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_      ):
 UpperCAmelCase			:      Optional[int]		   =					set()
 for row in edge_array:
  for item in row:
   distinct_edge.add(item[0]      )
 return list(lowercase_      )




def  UpperCamelCase(	UpperCAmelCase_    ,			UpperCAmelCase_      ):
 UpperCAmelCase			:      Optional[int]		   =					['0'] * len(lowercase_      )
 for i, row in enumerate(lowercase_      ):
  for item in row:
   if distinct_edge in item[0]:
    UpperCAmelCase			:      Any		   =					'1'
    break
 return "".join(lowercase_      )




def  UpperCamelCase(	UpperCAmelCase_      ):
 UpperCAmelCase			:      Dict		   =					get_distinct_edge(lowercase_      )
 UpperCAmelCase			:      Tuple		   =					{}

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




def  UpperCamelCase(	UpperCAmelCase_      ):
 UpperCAmelCase			:      Dict		   =					{}
 for _, item in enumerate(lowercase_      ):
  nodes.setdefault(item[2]    ,			[]      ).append(item[0]      )
 return nodes




def  UpperCamelCase(	UpperCAmelCase_      ):
 UpperCAmelCase			:      List[str]		   =					{}
 for key, value in nodes.items():
  UpperCAmelCase			:      Any		   =					value
 return cluster




def  UpperCamelCase(	UpperCAmelCase_      ):
 return [i * 1_00 / len(lowercase_      ) for i in cluster]




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




def  UpperCamelCase(	UpperCAmelCase_    ,			UpperCAmelCase_    ,			UpperCAmelCase_    ,			UpperCAmelCase_      ):

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




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




def  UpperCamelCase(	UpperCAmelCase_    ,			UpperCAmelCase_    ,			UpperCAmelCase_    ,			UpperCAmelCase_=None      ):
 UpperCAmelCase			:      Tuple		   =					(path or []) + [start]
 if start == end:
  paths.append(lowercase_      )
 for node in graph[start]:
  if tuple(lowercase_      ) not in path:
   my_dfs(lowercase_    ,			tuple(lowercase_      )    ,			lowercase_    ,			lowercase_      )




def  UpperCamelCase(	UpperCAmelCase_    ,			UpperCAmelCase_    ,			UpperCAmelCase_      ):
 UpperCAmelCase			:      int		   =					int(s / 1_00 * (len(lowercase_      ) - 1)      )
 for i in cluster[k]:
  my_dfs(lowercase_    ,			tuple(cluster[k][i]      )    ,			(['Header'],)      )




def  UpperCamelCase(	UpperCAmelCase_      ):
 UpperCAmelCase			:      Optional[int]		   =					[]
 for edges in paths:
  UpperCAmelCase			:      str		   =					[]
  for j in range(len(lowercase_      ) - 1      ):
   UpperCAmelCase			:      List[Any]		   =					list(edges[j]      )
   for e in temp:
    UpperCAmelCase			:      Dict		   =					(e[0], e[1])
    el.append(lowercase_      )
  freq_sub_el.append(lowercase_      )
 return freq_sub_el




def  UpperCamelCase(	UpperCAmelCase_      ):

 for i in range(len(lowercase_      )      ):
  for j in range(len(edge_array[i]      )      ):
   UpperCAmelCase			:      Optional[Any]		   =					edge_array[i][j].split('-'      )
   UpperCAmelCase			:      Optional[Any]		   =					t


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












def 						A_					(						lowercase_	,  lowercase_			)				->List[Any]:







 """simple docstring"""

 SCREAMING_SNAKE_CASE				    =		1
 while b > 0:
  if b & 1:
   res *= a

  a *= a
  b >>= 1

 return res





def 						A_					(						lowercase_	,  lowercase_	,  lowercase_			)				->Any:







 """simple docstring"""

 SCREAMING_SNAKE_CASE				    =		1
 while b > 0:
  if b & 1:
   SCREAMING_SNAKE_CASE				    =		((res % c) * (a % c)) % c

  a *= a
  b >>= 1

 return res




