Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tonicanada/b4dcf30246f9a5c67395ad8514487760 to your computer and use it in GitHub Desktop.
Save tonicanada/b4dcf30246f9a5c67395ad8514487760 to your computer and use it in GitHub Desktop.
def check_vertex_transitive(adj_matrix):
vertex_comb = list(itertools.permutations(range(len(adj_matrix)), 2))
automorphisms_perm = [
auto["perm_vertex"] for auto in generate_automorphisms(adj_matrix)
]
check = [None] * len(vertex_comb)
for pair_vertex_idx in range(len(vertex_comb)):
for auto_idx in range(len(automorphisms_perm)):
if automorphisms_perm[auto_idx][vertex_comb[pair_vertex_idx][
0]] == vertex_comb[pair_vertex_idx][1]:
check[pair_vertex_idx] = True
return all(check)
def check_edge_transitive(adj_matrix):
edge_comb = list(itertools.permutations(edge_set(adj_matrix), 2))
automorphisms_perm = [
auto["perm_edge"] for auto in generate_automorphisms(adj_matrix)
]
check = [None] * len(edge_comb)
for pair_edges_idx in range(len(edge_comb)):
for auto_idx in range(len(automorphisms_perm)):
edge_idx_to_check = automorphisms_perm[auto_idx][0].index(edge_comb[pair_edges_idx][0])
if automorphisms_perm[auto_idx][1][edge_idx_to_check] == edge_comb[pair_edges_idx][1]:
check[pair_edges_idx] = True
return all(check)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment