New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
faster matching polynomial #17921
Comments
Branch: u/pernici/ticket/17921 |
Commit: |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:6
I clean the description of the ticket to make it readable. Could you try to make it understandable? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:9
I added an explanation on the use of nilpotent elements and two more examples. |
comment:10
The greedy argument to order edges in active_nodes.py orders edges in such a way that the graph This algorithm can be probably improved using some |
comment:11
Please try to get 100% coverage ( |
comment:12
failing doctests, see patchbot report plus very bad formatting of the doc |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:17
I personally don't care about this ticket, but let me mention that it doesn't apply and that it should be rebased on top of #23126. |
Added
matching_generating_poly
, modifiedmatching_polynomial
, added an optionto
permanental_minor_polynomial
, which for some graphs is faster than the previousalgorithm.
matching_generating_poly
computes the matching generating polynomialon (possibly weighted) graphs; this is used in
permanental_minor_polynomial
.The algorithm (see [ButPer]) uses polynomials on nilpotent elements,
implemented in the class
Hobj
in matchpoly.pyx.The idea is that the matching generating polynomial can be computed from
the product of terms
(1 + x w_{i j} \eta_i \eta_j)
, for all edges(i, j)
where
w_{i j}
is the weight of the edge(i, j)
and\eta_i^2 = \eta_j^2=0
.The term
1
corresponds to the absence of the dimer(i,j)
,the other term to its presence. A configuration with two adjacent dimers
does not contribute due to nilpotency. The matching generating polynomial
is given by the sum of the coefficients of the non-vanishing products of
\eta
's.While the result does not depend on the ordering of the edges in the above
product, the speed of the algorithm depends on the ordering; in fact doing
the above product from left to right, one can set
\eta_i=1
as soonas
\eta_i
does not appear in the yet unused factors on the right, reducingin this way the number of terms.
A greedy argument to order edges is contained in active_nodes.py
The Godsil algorithm is faster for small graphs, which take little time
with either algorithms; it becomes progressively slower as the number
of vertices increases; e.g. on my computer
for
graphs.KnightGraph([4, n])
, the Godsil algorithmfor
n=5
is 25% faster, forn=6
5x slower, forn=9
4000x slower.The new algorithm can be much faster than the
rook
algorithm for matching polynomials of bipartite graphsIt is also much faster than the previous algorithm (now called
bipartite
)for computing the sum of the permanental minors, in the case of randomized band matrices
CC: @videlec @nathanncohen
Component: graph theory
Branch/Commit: u/pernici/ticket/17921 @
c87c039
Issue created by migration from https://trac.sagemath.org/ticket/17921
The text was updated successfully, but these errors were encountered: