triangular_subset = pgl2_upper_triangular(q) number_of_triangular_elements = len(triangular_subset) elements_generator = IterableElementsGenerator(triangular_subset) projective_zero = pgl2.get_pf().zero() action = StabilizedPGLGroupAction(pgl2, [projective_zero], elements_generator) representation = PermutationRepresentation(action) up_to_conjugation_elements = {} for element in triangular_subset: conjugation_class = pgl2.get_conjugation_class(element) if conjugation_class not in up_to_conjugation_elements: up_to_conjugation_elements[conjugation_class] = 0 up_to_conjugation_elements[conjugation_class] += 1 graph_labelling = UpToConjugationGraphLabelling(up_to_conjugation_elements, elements_generator) graph_covering = GraphCovering(graph, representation) action2 = PGLGroupAction(pgl2) representation2 = TransitiveActionUnitaryStandardRepresentation(action2, pgl2.get_pf().infinity()) graph_labelling2 = UpToConjugationGraphLabelling(conjugation_classes, pgl2) graph_covering2 = GraphCovering(graph, representation2) matching_polynomials = {} characteristic_polynomials = {} for labelling, weight in graph_labelling.weighted_labellings(graph): adjacency = graph_covering.adjacency(labelling).astype(int) lifted_graph = from_numpy_matrix(adjacency, create_using=nx.MultiGraph, parallel_edges=True) polynomial = get_matching_polynomial(lifted_graph) matching_polynomials[list(labelling.values())[0]] = (polynomial, weight)
return minimizing_function graph = nx.configuration_model((2, )) q = 5 pgl2 = PGL2(q) conjugation_classes = pgl2.get_conjugation_classes() number_of_elements = sum(conjugation_classes.values()) action2 = PGLGroupAction(pgl2) representation = TransitiveActionUnitaryStandardRepresentation( action2, pgl2.get_pf().infinity()) graph_labelling = UpToConjugationGraphLabelling(conjugation_classes, pgl2) graph_covering = GraphCovering(graph, representation) characteristic_polynomials = {} for labelling, weight in graph_labelling.weighted_labellings(graph): polynomial = graph_covering.get_polynomial(labelling) characteristic_polynomials[list(labelling.values())[0]] = (polynomial, weight) m = [] elements = list(characteristic_polynomials.keys()) for g in characteristic_polynomials: m.append(characteristic_polynomials[g][1] * characteristic_polynomials[g][0])
next(qs) n = 5 d = 4 graph = nx.random_regular_graph(d, n) rho = get_rho(d) for q in qs: pgl2 = PGL2(q) action = PGLGroupAction(pgl2) representation = TransitiveActionUnitaryStandardRepresentation( action, pgl2.get_pf().infinity()) covering = GraphCovering(graph, representation) graph_labelling = GraphLabelling(pgl2) labellings = list(graph_labelling.random_labellings(graph, 100)) adjacencies = [covering.adjacency(labelling) for labelling in labellings] roots = [ sorted(GraphCoveringSpectrumAnalyzer.get_eigenvalues(matrix)) for matrix in adjacencies ] roots = np.round(roots, 2) good_roots = [] bad_roots = [] good_roots_found = False for x in roots:
graph = nx.configuration_model((2, )) graph2 = nx.configuration_model((4, )) pgl2 = PGL2(q) action = PGLGroupAction(pgl2) representation = TransitiveActionUnitaryStandardRepresentation( action, pgl2.get_pf().infinity()) characters = [ WedgeCharacter.create_wedge_character(representation, i) for i in range(q + 1) ] conjugation_classes = list(pgl2.get_conjugation_classes().keys()) graph_covering = GraphCovering(graph, representation) graph_covering2 = GraphCovering(graph2, representation) graph_labelling = UpToConjugationGraphLabelling(pgl2.get_conjugation_classes(), pgl2) def trace_measure(x): return q - characters[1].apply(x) def cycle_length_measure_1(x): fixed_points = characters[1].apply(x) fixed_points = round(fixed_points) + 1 if fixed_points == q + 1: return 1 / (q * (q + 1)) elif fixed_points == 2:
from group_actions.pgl2_group_action import PGLGroupAction graph = nx.random_regular_graph(2, 3) # graph = nx.configuration_model((2,)) q = 7 pgl2 = PGL2(q) conjugation_classes = pgl2.get_conjugation_classes() elements_generator = pgl2 action = PGLGroupAction(pgl2) representation = PermutationRepresentation(action) up_to_conjugation_elements = pgl2.get_conjugation_classes() graph_labelling = UpToConjugationGraphLabelling(up_to_conjugation_elements, elements_generator) graph_covering = GraphCovering(graph, representation) matching_polynomials = [] matching_polynomials2 = {} weights = [] for labelling, weight in graph_labelling.weighted_labellings(graph): adjacency = graph_covering.adjacency(labelling).astype(int) lifted_graph = from_numpy_matrix(adjacency, create_using=nx.MultiGraph, parallel_edges=True) polynomial = get_matching_polynomial(lifted_graph) matching_polynomials.append(polynomial) matching_polynomials2[list(labelling.values())[0]] = polynomial weights.append(weight)