Example #1
0
def directed_graph_has_odd_automorphism(g):
    n = len(g)
    edges = g.edges()
    G = DiGraph([list(range(n)), edges])
    for sigma in G.automorphism_group().gens(
    ):  # NOTE: it suffices to check generators
        edge_permutation = [
            tuple([sigma(edge[0]), sigma(edge[1])]) for edge in edges
        ]
        index_permutation = [edges.index(e) for e in edge_permutation]
        if selection_sort(index_permutation) == -1:
            return True
    return False
Example #2
0
def formality_graph_has_odd_automorphism(g):
    n = len(g)
    edges = g.edges()
    partition = [[v] for v in range(g.num_ground_vertices())] + [
        list(
            range(g.num_ground_vertices(),
                  g.num_ground_vertices() + g.num_aerial_vertices()))
    ]
    G = DiGraph([list(range(n)), edges])
    for sigma in G.automorphism_group(partition=partition).gens(
    ):  # NOTE: it suffices to check generators
        edge_permutation = [
            tuple([sigma(edge[0]), sigma(edge[1])]) for edge in edges
        ]
        index_permutation = [edges.index(e) for e in edge_permutation]
        if selection_sort(index_permutation) == -1:
            return True
    return False