

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





def 			_lowercase    (      __UpperCamelCase     :		int   ,       __UpperCamelCase     :		int ):
      snake_case__					=   ["""0"""] * len(__UpperCamelCase )
      for i, row in enumerate(__UpperCamelCase ):
            for item in row:
                  if distinct_edge in item[0]:
                        snake_case__					=   """1"""
                        break
      return "".join(__UpperCamelCase )





def 			_lowercase    (      __UpperCamelCase     :		int ):
      snake_case__					=   get_distinct_edge(__UpperCamelCase )
      snake_case__					=   {}

      for item in distinct_edge:
            snake_case__					=   get_bitcode(__UpperCamelCase   ,       __UpperCamelCase )
            # print('bit',bit)
            # bt=''.join(bit)
            snake_case__					=   bit.count("""1""" )
            snake_case__					=   [s, bit]
      # Store [Distinct edge, WT(Bitcode), Bitcode] in descending order
      snake_case__					=   [
          [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 			_lowercase    (      __UpperCamelCase     :		Any ):
      snake_case__					=   {}
      for _, item in enumerate(__UpperCamelCase ):
            nodes.setdefault(item[2]   ,       [] ).append(item[0] )
      return nodes





def 			_lowercase    (      __UpperCamelCase     :		Dict ):
      snake_case__					=   {}
      for key, value in nodes.items():
            snake_case__					=   value
      return cluster





def 			_lowercase    (      __UpperCamelCase     :		int ):
      return [i * 100 / len(__UpperCamelCase ) for i in cluster]





def 			_lowercase    (      ):
      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 			_lowercase    (      __UpperCamelCase     :		str   ,       __UpperCamelCase     :		Tuple   ,       __UpperCamelCase     :		Union[str, Any]   ,       __UpperCamelCase     :		Optional[Any] ):
      for i in cluster[ca]:
            snake_case__					=   0
            snake_case__					=   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:
                                    snake_case__					=   [nodes[j]]
                              count += 1
                  if count == 0:
                        snake_case__					=   ca + 1
                  else:
                        break





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





def 			_lowercase    (      __UpperCamelCase     :		List[Any]   ,       __UpperCamelCase     :		str   ,       __UpperCamelCase     :		str   ,       __UpperCamelCase     :		List[str]=None ):
      snake_case__					=   (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 			_lowercase    (      __UpperCamelCase     :		Any   ,       __UpperCamelCase     :		int   ,       __UpperCamelCase     :		Optional[int] ):
      snake_case__					=   int(s / 100 * (len(__UpperCamelCase ) - 1) )
      for i in cluster[k]:
            my_dfs(__UpperCamelCase   ,       tuple(cluster[k][i] )   ,       (["""Header"""],) )





def 			_lowercase    (      __UpperCamelCase     :		int ):
      snake_case__					=   []
      for edges in paths:
            snake_case__					=   []
            for j in range(len(__UpperCamelCase ) - 1 ):
                  snake_case__					=   list(edges[j] )
                  for e in temp:
                        snake_case__					=   (e[0], e[1])
                        el.append(__UpperCamelCase )
            freq_sub_el.append(__UpperCamelCase )
      return freq_sub_el





def 			_lowercase    (      __UpperCamelCase     :		Dict ):
      for i in range(len(__UpperCamelCase ) ):
            for j in range(len(edge_array[i] ) ):
                  snake_case__					=   edge_array[i][j].split("""-""" )
                  snake_case__					=   t


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









from doctest import testmod
from math import sqrt





def 			_lowercase    (      __UpperCamelCase     :		int ):
      snake_case__					=   []
      if num < 1:
            return facs
      facs.append(1 )
      if num == 1:
            return facs
      facs.append(__UpperCamelCase )
      for i in range(2   ,       int(sqrt(__UpperCamelCase ) ) + 1 ):
            if num % i == 0:  # If i is a factor of num
                  facs.append(__UpperCamelCase )
                  snake_case__					=   num // i  # num//i is the other factor of num
                  if d != i:  # If d and i are distinct
                        facs.append(__UpperCamelCase )  # we have found another factor
      facs.sort()
      return facs


if __name__ == "__main__":
       testmod(name='''factors_of_a_number''', verbose=True)






