






'''simple docstring'''


lowerCamelCase_					:			List[str]     						=				[
    ['''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 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			set()
						for row in edge_array:
												for item in row:
																		distinct_edge.add(item[0]       )
						return list(_A       )







def 						__magic_name__(			_A    ,   _A       ):
						'''simple docstring'''





						UpperCamelCase__       =			["""0"""] * len(_A       )
						for i, row in enumerate(_A       ):
												for item in row:
																		if distinct_edge in item[0]:
																								UpperCamelCase__       =			"""1"""
																								break
						return "".join(_A       )







def 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			get_distinct_edge(_A       )
						UpperCamelCase__       =			{}

						for item in distinct_edge:
												UpperCamelCase__       =			get_bitcode(_A    ,   _A       )
												# print('bit',bit)
												# bt=''.join(bit)
												UpperCamelCase__       =			bit.count("""1"""       )
												UpperCamelCase__       =			[s, bit]
						# Store [Distinct edge, WT(Bitcode), Bitcode] in descending order
						UpperCamelCase__       =			[
						    [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 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			{}
						for _, item in enumerate(_A       ):
												nodes.setdefault(item[2]    ,   []       ).append(item[0]       )
						return nodes







def 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			{}
						for key, value in nodes.items():
												UpperCamelCase__       =			value
						return cluster







def 						__magic_name__(			_A       ):
						'''simple docstring'''





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







def 						__magic_name__(			):
						'''simple docstring'''





						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 						__magic_name__(			_A    ,   _A    ,   _A    ,   _A       ):
						'''simple docstring'''





						for i in cluster[ca]:
												UpperCamelCase__       =			0
												UpperCamelCase__       =			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:
																																				UpperCamelCase__       =			[nodes[j]]
																														count += 1
																		if count == 0:
																								UpperCamelCase__       =			ca + 1
																		else:
																								break







def 						__magic_name__(			_A    ,   _A       ):
						'''simple docstring'''





						UpperCamelCase__       =			cluster[max(cluster.keys()       )]
						UpperCamelCase__       =			"""Header"""
						UpperCamelCase__       =			{}
						for i in x:
												if (["Header"],) in graph:
																		graph[(["Header"],)].append(x[i]       )
												else:
																		UpperCamelCase__       =			[x[i]]
						for i in x:
												UpperCamelCase__       =			[["""Header"""]]
						UpperCamelCase__       =			1
						while i < max(_A       ) - 1:
												create_edge(_A    ,   _A    ,   _A    ,   _A       )
												UpperCamelCase__       =			i + 1
						return graph







def 						__magic_name__(			_A    ,   _A    ,   _A    ,   _A=None       ):
						'''simple docstring'''





						UpperCamelCase__       =			(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 						__magic_name__(			_A    ,   _A    ,   _A       ):
						'''simple docstring'''





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







def 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			[]
						for edges in paths:
												UpperCamelCase__       =			[]
												for j in range(len(_A       ) - 1       ):
																		UpperCamelCase__       =			list(edges[j]       )
																		for e in temp:
																								UpperCamelCase__       =			(e[0], e[1])
																								el.append(_A       )
												freq_sub_el.append(_A       )
						return freq_sub_el







def 						__magic_name__(			_A       ):
						'''simple docstring'''





						for i in range(len(_A       )       ):
												for j in range(len(edge_array[i]       )       ):
																		UpperCamelCase__       =			edge_array[i][j].split("""-"""       )
																		UpperCamelCase__       =			t


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








'''simple docstring'''


import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
					import torch

if is_vision_available():
					from PIL import Image

					from transformers import EfficientNetImageProcessor
class  _SCREAMING_SNAKE_CASE				(		unittest.TestCase						):


			'''simple docstring'''





			def __init__( self				:    List[str]			,   lowercase				:    Optional[Any]			,   lowercase				:    int=1_3			,   lowercase				:    List[Any]=3			,   lowercase				:    int=1_8			,   lowercase				:    List[Any]=3_0			,   lowercase				:    Optional[int]=4_0_0			,   lowercase				:    Any=True			,   lowercase				:    int=None			,   lowercase				:    Any=True			,   lowercase				:    Optional[int]=[0.5, 0.5, 0.5]			,   lowercase				:    List[Any]=[0.5, 0.5, 0.5]			,   )				->     List[Any]:

									'''simple docstring'''







									UpperCamelCase__       =			size if size is not None else {"""height""": 1_8, """width""": 1_8}
									UpperCamelCase__       =			parent
									UpperCamelCase__       =			batch_size
									UpperCamelCase__       =			num_channels
									UpperCamelCase__       =			image_size
									UpperCamelCase__       =			min_resolution
									UpperCamelCase__       =			max_resolution
									UpperCamelCase__       =			do_resize
									UpperCamelCase__       =			size
									UpperCamelCase__       =			do_normalize
									UpperCamelCase__       =			image_mean
									UpperCamelCase__       =			image_std







			def 					A   ( self				:    Optional[Any]      )				->     Any:

									'''simple docstring'''







									return {
									    "image_mean": self.image_mean,
									    "image_std": self.image_std,
									    "do_normalize": self.do_normalize,
									    "do_resize": self.do_resize,
									    "size": self.size,
									}
@require_torch
@require_vision
class  _SCREAMING_SNAKE_CASE				(		SCREAMING_SNAKE_CASE							,unittest.TestCase						):


			'''simple docstring'''





			__a				:				List[Any]         =       EfficientNetImageProcessor if is_vision_available() else None






			def 					A   ( self				:    Optional[Any]      )				->     str:

									'''simple docstring'''







									UpperCamelCase__       =			EfficientNetImageProcessorTester(self      )






			@property
			def 					A   ( self				:    Optional[int]      )				->     Optional[Any]:

									'''simple docstring'''







									return self.image_processor_tester.prepare_image_processor_dict()






			def 					A   ( self				:    Dict      )				->     str:

									'''simple docstring'''







									UpperCamelCase__       =			self.image_processing_class(**self.image_processor_dict      )
									self.assertTrue(hasattr(lowercase			,   """image_mean"""      )      )
									self.assertTrue(hasattr(lowercase			,   """image_std"""      )      )
									self.assertTrue(hasattr(lowercase			,   """do_normalize"""      )      )
									self.assertTrue(hasattr(lowercase			,   """do_resize"""      )      )
									self.assertTrue(hasattr(lowercase			,   """size"""      )      )






			def 					A   ( self				:    List[str]      )				->     Optional[int]:

									'''simple docstring'''







									UpperCamelCase__       =			self.image_processing_class.from_dict(self.image_processor_dict      )
									self.assertEqual(image_processor.size			,   {"""height""": 1_8, """width""": 1_8}      )

									UpperCamelCase__       =			self.image_processing_class.from_dict(self.image_processor_dict			,   size=4_2      )
									self.assertEqual(image_processor.size			,   {"""height""": 4_2, """width""": 4_2}      )






			def 					A   ( self				:    Union[str, Any]      )				->     str:

									'''simple docstring'''







									UpperCamelCase__       =			self.image_processing_class(**self.image_processor_dict      )
									# create random PIL images
									UpperCamelCase__       =			prepare_image_inputs(self.image_processor_tester			,   equal_resolution=lowercase      )
									for image in image_inputs:
															self.assertIsInstance(lowercase			,   Image.Image      )

									# Test not batched input
									UpperCamelCase__       =			image_processing(image_inputs[0]			,   return_tensors="""pt"""      ).pixel_values
									self.assertEqual(
									    encoded_images.shape			,   (
									        1,
									        self.image_processor_tester.num_channels,
									        self.image_processor_tester.size["""height"""],
									        self.image_processor_tester.size["""width"""],
									    )			,   )

									# Test batched
									UpperCamelCase__       =			image_processing(lowercase			,   return_tensors="""pt"""      ).pixel_values
									self.assertEqual(
									    encoded_images.shape			,   (
									        self.image_processor_tester.batch_size,
									        self.image_processor_tester.num_channels,
									        self.image_processor_tester.size["""height"""],
									        self.image_processor_tester.size["""width"""],
									    )			,   )






			def 					A   ( self				:    Dict      )				->     Optional[int]:

									'''simple docstring'''







									UpperCamelCase__       =			self.image_processing_class(**self.image_processor_dict      )
									# create random numpy tensors
									UpperCamelCase__       =			prepare_image_inputs(self.image_processor_tester			,   equal_resolution=lowercase			,   numpify=lowercase      )
									for image in image_inputs:
															self.assertIsInstance(lowercase			,   np.ndarray      )

									# Test not batched input
									UpperCamelCase__       =			image_processing(image_inputs[0]			,   return_tensors="""pt"""      ).pixel_values
									self.assertEqual(
									    encoded_images.shape			,   (
									        1,
									        self.image_processor_tester.num_channels,
									        self.image_processor_tester.size["""height"""],
									        self.image_processor_tester.size["""width"""],
									    )			,   )

									# Test batched
									UpperCamelCase__       =			image_processing(lowercase			,   return_tensors="""pt"""      ).pixel_values
									self.assertEqual(
									    encoded_images.shape			,   (
									        self.image_processor_tester.batch_size,
									        self.image_processor_tester.num_channels,
									        self.image_processor_tester.size["""height"""],
									        self.image_processor_tester.size["""width"""],
									    )			,   )







			def 					A   ( self				:    Optional[int]      )				->     List[str]:

									'''simple docstring'''







									UpperCamelCase__       =			self.image_processing_class(**self.image_processor_dict      )
									# create random PyTorch tensors
									UpperCamelCase__       =			prepare_image_inputs(self.image_processor_tester			,   equal_resolution=lowercase			,   torchify=lowercase      )
									for image in image_inputs:
															self.assertIsInstance(lowercase			,   torch.Tensor      )

									# Test not batched input
									UpperCamelCase__       =			image_processing(image_inputs[0]			,   return_tensors="""pt"""      ).pixel_values
									self.assertEqual(
									    encoded_images.shape			,   (
									        1,
									        self.image_processor_tester.num_channels,
									        self.image_processor_tester.size["""height"""],
									        self.image_processor_tester.size["""width"""],
									    )			,   )

									# Test batched
									UpperCamelCase__       =			image_processing(lowercase			,   return_tensors="""pt"""      ).pixel_values
									self.assertEqual(
									    encoded_images.shape			,   (
									        self.image_processor_tester.batch_size,
									        self.image_processor_tester.num_channels,
									        self.image_processor_tester.size["""height"""],
									        self.image_processor_tester.size["""width"""],
									    )			,   )
