Skip to content

Commit

Permalink
Trac #27232: is_isomorphic broken with keyword edge_labels=True
Browse files Browse the repository at this point in the history
This code led to finding this bug in the `is_isomorphic` method.

Here is a simple working example:

{{{
sage: m1 = matrix(ZZ, [[1, -1, -1], [-1, -1, -1], [1, 0, -1]])
sage: m2 = matrix(ZZ, [[-1, -1, -1], [-1, 1, -1], [-1, 1, 0]])
}}}

The two matrices are equal up to permutation of rows and columns:

{{{
sage: m1.is_permutation_of(m2)
True
}}}

But, not over `CyclotomicField`s:

{{{
sage: CF = CyclotomicField(1)
sage: p1 = matrix(CF, [[1, -1, -1], [-1, -1, -1], [1, 0, -1]])
sage: p2 = matrix(CF, [[-1, -1, -1], [-1, 1, -1], [-1, 1, 0]])
sage: p1.is_permutation_of(p2)
False
}}}

Even with 2 is also does not work:

{{{
sage: CF = CyclotomicField(2)
sage: p1 = matrix(CF, [[1, -1, -1], [-1, -1, -1], [1, 0, -1]])
sage: p2 = matrix(CF, [[-1, -1, -1], [-1, 1, -1], [-1, 1, 0]])
sage: p1.is_permutation_of(p2)
False
}}}

This error is provoked at the level of graphs:

{{{
sage: g1 = p1.as_bipartite_graph()
sage: g2 = p2.as_bipartite_graph()
sage: sorted(g1.edge_labels())
[1, -1, -1, -1, -1, -1, 1, 0, -1]
sage: sorted(g2.edge_labels())
[-1, -1, -1, -1, 1, -1, -1, 1, 0]
}}}

URL: https://trac.sagemath.org/27232
Reported by: jipilab
Ticket author(s): David Coudert
Reviewer(s): Travis Scrimshaw, John Palmieri
  • Loading branch information
Release Manager committed Jul 19, 2019
2 parents 5392aef + b2218f2 commit 13ca260
Show file tree
Hide file tree
Showing 2 changed files with 204 additions and 121 deletions.
10 changes: 5 additions & 5 deletions src/sage/combinat/root_system/coxeter_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,11 @@ def recognize_coxeter_type_from_matrix(coxeter_matrix, index_set):
"""
# First, we build the Coxeter graph of the group without the edge labels
n = ZZ(coxeter_matrix.nrows())
G = Graph([[index_set[i], index_set[j], coxeter_matrix[i, j]]
for i in range(n) for j in range(i, n)
if coxeter_matrix[i, j] not in [1, 2]],
format='list_of_edges')
G.add_vertices(index_set)
G = Graph([index_set,
[(index_set[i], index_set[j], coxeter_matrix[i, j])
for i in range(n) for j in range(i, n)
if coxeter_matrix[i, j] not in [1, 2]]],
format='vertices_and_edges')

types = []
for S in G.connected_components_subgraphs():
Expand Down
Loading

0 comments on commit 13ca260

Please sign in to comment.