Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fixed a bug in matching_polynomial; added test.
Browse files Browse the repository at this point in the history
  • Loading branch information
pernici committed Jan 12, 2015
1 parent e03f93a commit 127418f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/sage/graphs/bipartite_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,17 @@ def matching_polynomial(self, algorithm="Godsil", name=None):
sage: p = g.characteristic_polynomial()
sage: p == BipartiteGraph(g).matching_polynomial(algorithm='rook')
True
TESTS::
sage: g = BipartiteGraph(matrix.ones(4,3))
sage: g.matching_polynomial()
x^7 - 12*x^5 + 36*x^3 - 24*x
sage: g.matching_polynomial(algorithm="rook")
x^7 - 12*x^5 + 36*x^3 - 24*x
"""
if algorithm == "Godsil":
return Graph.matching_polynomial(self, name=name)
return Graph.matching_polynomial(self, complement=False, name=name)
elif algorithm == "rook":
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
A = self.reduced_adjacency_matrix()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ cdef class Matrix(matrix1.Matrix):
"ButeraPernici" (default) or "Godsil"; Ryser one might be faster on
simple and small instances. Godsil only accepts input in 0,1.

- ``complement`` -- boolean (default: ``False``) wether we consider the
- ``complement`` -- boolean (default: ``False``) whether we consider the
rook vector of the complement matrix. If set to ``True`` then the
matrix must have entries in {0, 1} and the complement matrix is the
one for which the 0's are replaced by 1's and 1's by 0's.
Expand Down

0 comments on commit 127418f

Please sign in to comment.