_snake_case			=						[
    ['''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   (			snake_case__							)						->   Optional[int]:
							__UpperCAmelCase						:			List[Any]         =   set()
							for row in edge_array:
														for item in row:
																					distinct_edge.add(item[0]							)
							return list(snake_case__							)




def   _UpperCamelCase   (			snake_case__,    snake_case__							)						->   Tuple:
							__UpperCAmelCase						:			Tuple         =   ["0"] * len(snake_case__							)
							for i, row in enumerate(snake_case__							):
														for item in row:
																					if distinct_edge in item[0]:
																												__UpperCAmelCase						:			int         =   "1"
																												break
							return "".join(snake_case__							)




def   _UpperCamelCase   (			snake_case__							)						->   Any:
							__UpperCAmelCase						:			List[str]         =   get_distinct_edge(snake_case__							)
							__UpperCAmelCase						:			Tuple         =   {}

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




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




def   _UpperCamelCase   (			snake_case__							)						->   str:
							__UpperCAmelCase						:			Tuple         =   {}
							for key, value in nodes.items():
														__UpperCAmelCase						:			Optional[Any]         =   value
							return cluster




def   _UpperCamelCase   (			snake_case__							)						->   str:
							return [i * 100 / len(snake_case__							) for i in cluster]




def   _UpperCamelCase   (			)						->   None:
							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   (			snake_case__,    snake_case__,    snake_case__,    snake_case__							)						->   Dict:
							for i in cluster[ca]:
														__UpperCAmelCase						:			List[str]         =   0
														__UpperCAmelCase						:			Tuple         =   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						:			Any         =   [nodes[j]]
																																			count += 1
																					if count == 0:
																												__UpperCAmelCase						:			int         =   ca + 1
																					else:
																												break




def   _UpperCamelCase   (			snake_case__,    snake_case__							)						->   str:
							__UpperCAmelCase						:			Union[str, Any]         =   cluster[max(cluster.keys()							)]
							__UpperCAmelCase						:			int         =   "Header"
							__UpperCAmelCase						:			int         =   {}
							for i in x:
														if (["Header"],) in graph:
																					graph[(["Header"],)].append(x[i]							)
														else:
																					__UpperCAmelCase						:			List[Any]         =   [x[i]]
							for i in x:
														__UpperCAmelCase						:			Union[str, Any]         =   [["Header"]]
							__UpperCAmelCase						:			Any         =   1
							while i < max(snake_case__							) - 1:
														create_edge(snake_case__,    snake_case__,    snake_case__,    snake_case__							)
														__UpperCAmelCase						:			List[str]         =   i + 1
							return graph




def   _UpperCamelCase   (			snake_case__,    snake_case__,    snake_case__,    snake_case__=None							)						->   Tuple:
							__UpperCAmelCase						:			Optional[int]         =   (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   (			snake_case__,    snake_case__,    snake_case__							)						->   int:
							__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   (			snake_case__							)						->   Union[str, Any]:
							__UpperCAmelCase						:			Tuple         =   []
							for edges in paths:
														__UpperCAmelCase						:			List[Any]         =   []
														for j in range(len(snake_case__							) - 1							):
																					__UpperCAmelCase						:			List[Any]         =   list(edges[j]							)
																					for e in temp:
																												__UpperCAmelCase						:			List[Any]         =   (e[0], e[1])
																												el.append(snake_case__							)
														freq_sub_el.append(snake_case__							)
							return freq_sub_el




def   _UpperCamelCase   (			snake_case__							)						->   int:
							for i in range(len(snake_case__							)							):
														for j in range(len(edge_array[i]							)							):
																					__UpperCAmelCase						:			Optional[int]         =   edge_array[i][j].split("-"							)
																					__UpperCAmelCase						:			int         =   t


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





import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput




@dataclass
class 					_snake_case						(						_lowercase				):
					lowerCamelCase__:		float
					lowerCamelCase__:		Optional[float]  =     None
					lowerCamelCase__:		Optional[float]  =     None




class 					_snake_case						(						unittest.TestCase				):
					def    _lowerCamelCase (  self:				Union[str, Any]     )    ->				List[Any]:
												__UpperCAmelCase						:			str         =   ModelOutputTest(a=30     )
												self.assertEqual(x.a	,  30     )
												self.assertIsNone(x.b     )
												self.assertIsNone(x.c     )
												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			List[Any]         =   x.d
					def    _lowerCamelCase (  self:				Optional[int]     )    ->				str:
												__UpperCAmelCase						:			Union[str, Any]         =   ModelOutputTest(a=30	,  b=10     )
												self.assertEqual(x[0]	,  30     )
												self.assertEqual(x[1]	,  10     )
												self.assertEqual(x[:2]	,  (30, 10)     )
												self.assertEqual(x[:]	,  (30, 10)     )

												__UpperCAmelCase						:			Optional[Any]         =   ModelOutputTest(a=30	,  c=10     )
												self.assertEqual(x[0]	,  30     )
												self.assertEqual(x[1]	,  10     )
												self.assertEqual(x[:2]	,  (30, 10)     )
												self.assertEqual(x[:]	,  (30, 10)     )
					def    _lowerCamelCase (  self:				Tuple     )    ->				List[str]:
												__UpperCAmelCase						:			str         =   ModelOutputTest(a=30	,  b=10     )
												self.assertEqual(x["a"]	,  30     )
												self.assertEqual(x["b"]	,  10     )
												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			Dict         =   x["c"]

												__UpperCAmelCase						:			Tuple         =   ModelOutputTest(a=30	,  c=10     )
												self.assertEqual(x["a"]	,  30     )
												self.assertEqual(x["c"]	,  10     )
												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			Optional[Any]         =   x["b"]
					def    _lowerCamelCase (  self:				str     )    ->				Any:
												__UpperCAmelCase						:			Union[str, Any]         =   ModelOutputTest(a=30     )
												self.assertEqual(list(x.keys()     )	,  ["a"]     )
												self.assertEqual(list(x.values()     )	,  [30]     )
												self.assertEqual(list(x.items()     )	,  [("a", 30)]     )
												self.assertEqual(list(__lowerCamelCase     )	,  ["a"]     )

												__UpperCAmelCase						:			str         =   ModelOutputTest(a=30	,  b=10     )
												self.assertEqual(list(x.keys()     )	,  ["a", "b"]     )
												self.assertEqual(list(x.values()     )	,  [30, 10]     )
												self.assertEqual(list(x.items()     )	,  [("a", 30), ("b", 10)]     )
												self.assertEqual(list(__lowerCamelCase     )	,  ["a", "b"]     )

												__UpperCAmelCase						:			Any         =   ModelOutputTest(a=30	,  c=10     )
												self.assertEqual(list(x.keys()     )	,  ["a", "c"]     )
												self.assertEqual(list(x.values()     )	,  [30, 10]     )
												self.assertEqual(list(x.items()     )	,  [("a", 30), ("c", 10)]     )
												self.assertEqual(list(__lowerCamelCase     )	,  ["a", "c"]     )

												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			Dict         =   x.update({"d": 20}     )
												with self.assertRaises(__lowerCamelCase     ):
																			del x["a"]
												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			List[Any]         =   x.pop("a"     )
												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			str         =   x.setdefault("d"	,  32     )
					def    _lowerCamelCase (  self:				List[str]     )    ->				str:
												__UpperCAmelCase						:			Optional[Any]         =   ModelOutputTest(a=30     )
												__UpperCAmelCase						:			Tuple         =   10
												self.assertEqual(x.a	,  10     )
												self.assertEqual(x["a"]	,  10     )
					def    _lowerCamelCase (  self:				Optional[int]     )    ->				Dict:
												__UpperCAmelCase						:			str         =   ModelOutputTest(a=30     )
												__UpperCAmelCase						:			Optional[int]         =   10
												self.assertEqual(x.a	,  10     )
												self.assertEqual(x["a"]	,  10     )
					def    _lowerCamelCase (  self:				List[Any]     )    ->				Optional[int]:
												__UpperCAmelCase						:			Tuple         =   ModelOutputTest({"a": 30, "b": 10}     )
												self.assertEqual(list(x.keys()     )	,  ["a", "b"]     )
												self.assertEqual(x.a	,  30     )
												self.assertEqual(x.b	,  10     )





					def    _lowerCamelCase (  self:				Optional[int]     )    ->				Union[str, Any]:
												__UpperCAmelCase						:			Dict         =   ModelOutputTest([("a", 30), ("b", 10)]     )
												self.assertEqual(list(x.keys()     )	,  ["a", "b"]     )
												self.assertEqual(x.a	,  30     )
												self.assertEqual(x.b	,  10     )

												with self.assertRaises(__lowerCamelCase     ):
																			__UpperCAmelCase						:			Any         =   ModelOutputTest([("a", 30), (10, 10)]     )

												__UpperCAmelCase						:			Dict         =   ModelOutputTest(a=(30, 30)     )
												self.assertEqual(list(x.keys()     )	,  ["a"]     )
												self.assertEqual(x.a	,  (30, 30)     )




