Google Summer of Code 2015: outcomes

Guest post by Chao Xu

In the summer, I have extended the SAGE code base for matroids for Google Summer of Code. This post shows a few example of it’s new capabilities.


Let $M$ be a matroid with groundset $E$ and rank function $r$. A partition of the groundset $\{E_1,E_2\}$ is a $m$-separation if $|E_1|,|E_2|\geq m$ and $r(E_1)+r(E_2)-r(E)\leq m-1$. $M$ is called $k$-connected if there is no $m$-separation for any $m < k$. The Fano matroid is an example of $3$-connected matroid.

The Fano matroid is not $4$-connected. Using the certificate=True field, we can also output a certificate that verify its not-$4$-connectness. The certificate is a $m$-separation where $m < 4$. Since we know Fano matroid is $3$-connected, we know the output should be a $3$-separation.

We also have a method for deciding $k$-connectivity, and returning a certificate.

There are 3 algorithms for $3$-connectivity. One can pass it as a string to the algorithm field of is_3connected.

  1. "bridges": The $3$-connectivity algorithm Bixby and Cunningham. [BC79]
  2. "intersection": the matroid intersection based algorithm
  3. "shifting": the shifting algorithm. [Raj87]

The default algorithm is the bridges based algorithm.

The following is an example to compare the running time of each approach.

The new bridges based algorithm is much faster than the previous algorithm in SAGE.

For $4$-connectivity, we tried to use the shifting approach, which has an running time of $O(n^{4.5}\sqrt{\log n})$, where $n$ is the size of the groundset. The intuitive idea is fixing some elements and tries to grow a separator. In theory, the shifting algorithm should be fast if the graph is not $4$-connected, as we can be lucky and find a separator quickly. In practice, it is still slower than the optimized matroid intersection based algorithm, which have a worst case $O(n^5)$ running time. There might be two reasons: the matroid intersection actually avoids the worst case running time in practice, and the shifting algorithm is not well optimized.

Matroid intersection and union

There is a new implementation of matroid intersection algorithm based on Cunningham’s paper [Cun86]. For people who are familiar with blocking flow algorithms for maximum flows, this is the matroid version. The running time is $O(\sqrt{p}rn)$, where $p$ is the size of the maximum common independent set, $r$ is the rank, and $n$ is the size of the groundset. Here is an example of taking matroid intersection between two randomly generated linear matroids.

Using matroid intersection, we have preliminary support for matroid union and matroid sum. Both construction takes a list of matroids.

The matroid sum operation takes disjoint union of the groundsets. Hence the new ground set will have the first coordinate indicating which matroid it comes from, and second coordinate indicate the element in the matroid.

Here is an example of matroid union of two copies of uniform matroid $U(1,5)$ and $U(2,5)$. The output is isomorphic to $U(4,5)$.

One of the application of matroid union is matroid partitioning, which partitions the groundset of the matroid to minimum number of independent sets. Here is an example that partitions the edges of a graph to minimum number of forests.


I would like to thank my mentors Stefan van Zwam and Michael Welsh for helping me with the project. I also like to thank Rudi Pendavingh, who have made various valuable suggestions and implemented many optimizations himself.


[BC79] R.E Bixby, W.H Cunningham. Matroids, graphs and 3-connectivity, J.A Bondy, U.S.R Murty (Eds.), Graph Theory and Related Topics, Academic Press, New York (1979), pp. 91-103.

[Raj87] Rajan, A. (1987). Algorithmic applications of connectivity and related topics in matroid theory. Northwestern university.

[Cun86] William H Cunningham. 1986. Improved bounds for matroid partition and intersection algorithms. SIAM J. Comput. 15, 4 (November 1986), 948-957.

Chromatic polynomials II

In this week-late post I will talk some more about results and conjectures concerning chromatic polynomials of graphs and matroids. As the title suggests, this is a continuation from my April post on the same topic. At the end of that post I said that I would discuss complex chromatic roots of graphs, but here I’ve decided to talk about matroids instead.

The chromatic polynomial of graphs is defined in terms of number of colourings with a given number of colours; this definition does not extend to matroids for obvious reasons. However, the Recipe Theorem by Oxley and Welsh in [OW79] tells us that a function on graphs or matroids satisfying a deletion-contraction recursion is essentially an evaluation of the Tutte polynomial. Now the chromatic polynomial does satisfy this type of recursion, and in fact Tutte’s polynomial was first called by Tutte the dichromatic polynomial, since he saw it as a generalisation of the chromatic polynomial of a graph. If $T_G(x,y)$ denotes the Tutte polynomial of a graph $G$, then \[P(G,q)=(-1)^{|V(G)-k(G)}q^{k(G)}T_G(1-q,0).\]

This definition can easily be extended to matroids. However, the equivalent of the chromatic polynomial for matroids is called the characteristic polynomial, and it is very slightly different (in that is has a missing power of $q$ factor). The characteristic polynomial of a matroid $M$ is denoted as $C(M,q)$ and may be defined as \[C(M,q)=(-1)^{r(M)}T_M(1-q,0).\]

So if $G$ is a graph with $k(G)$ components and $M=M(G)$, then $C(M,q)=q^{-k(G)}P(G,q)$, which for our purposes means that the chromatic polynomial of a graph $G$ and the characteristic polynomial of its graphic matroid $M(G)$ are essentially the same. I’m not sure why this terminology was adopted, since the characteristic polynomial of a graph is the characteristic polynomial of its adjacency matrix, hence has nothing to do with the characteristic polynomial of its graphic matroid. Anyway, let’s see what we can say about real chromatic roots of matroids. We can still talk about root-free intervals and upper root-free intervals in the same way as for graphs.

Just to recap, a real interval $(a,b)$ is a root-free interval for a family of matroids $\mathcal{M}$ if no matroid in  $\mathcal{M}$ has a chromatic root (i.e. a root of its characteristic polynomial) in the interval $(a,b)$, while $\mathcal{M}$ has an upper root-free interval if there is a real number $a$ such that no matroid in $\mathcal{M}$ has a real root larger than $a$. The class of all matroids does not have an upper root-free interval (since you can get arbitrarily large chromatic roots from graphs). Many of the results I mentioned for graphs in my previous post generalise to matroids. In particular, if $M$ is a loopless connected matroid, then:

  • $C(M,q)$ is an alternating polynomial with degree $r(M)$,
  • $C(M,q)$ is non-zero with sign $(-1)^{r(E)}$ for $q\in (-\infty,0)$,
  • $C(M,q)$ has a simple zero at $q=1$, and
  • $C(M,q)$ is non-zero with sign $(-1)^{r(E)+1}$ for $q\in (0,\frac{32}{27})$.

As for graphs, the first three results are easy to see if you write the chromatic polynomial in the right form. Namely

\[C(M,q)=\sum_{X\subseteq E(M)}(-1)^{|X|}q^{r(E)-r(X)}.\]

The fourth result above was proved for matroids by Edwards, Hierons and Jackson [EHJ98]. So the magic number $\frac{32}{27}$ is still magic for matroids.

If a class of matroids contains all graphic matroids, then it has no upper root-free interval (because of cliques). What about minor-closed classes of matroids not containing all graphs?

If you recall, Woodall and Thomassen proved independently that if $\mathcal{G}$ is a proper minor-closed family of graphs, then $(d(\mathcal{G}),\infty)$ is an upper root-free interval for $\mathcal{G}$, where $d(\mathcal{G})$ is the minimum number such that every graph in $\mathcal{G}$ has a vertex of degree at most $d$ (this is finite by a theorem of Mader). The surprising fact is that this result was published in 1997, while it is in fact implied by a more general and quite a bit older result for matroids. In 1978 Oxley proved the following.

Theorem 1: Let $D=\{x_1,\ldots,x_k\}$ be a cocircuit of a matroid $M$. Then \[C(M,q)=(q-k)C(M\backslash D,q)+\sum_{j=2}^{k}\sum_{i=1}^{j-1} C(M\backslash x_1,\ldots,x_{i-1},x_{i+1},\ldots,x_{j-1}/x_i,x_j, q).\]

This looks a bit complicated, but by induction it implies the following.

Corollary 2: If all minors of a matroid $M$ have a cocircuit of size at most $k$, then $C(M,q)>0$ for all $q \geq k$.

Corollary 2 in turns implies that any proper minor-closed class of graphs has an upper root-free interval (i.e. the result of Woodall and Thomassen). It also implies the same result for matroids of bounded branch width. Unfortunately, minor-closed classes of matroids may not have bounded minimum cocircuit size, even if they don’t contain all graphic matroids, so the following is still wide open.

Conjecture 3: Every minor closed class of matroids that does not contain all graphic matroids has an upper root-free interval.

A very special but still very difficult case of this conjecture is the following.

Conjecture 4: The class of cographic matroids has an upper root-free interval.

Conjecture 4 has been studied quite a bit, since it is in fact a question on flows in graphs (the characteristic polynomial of a matroid is the flow polynomial of its dual). I’ll conclude the post with a bit of history on this problem.

Welsh conjecture that $(4,\infty)$ is an upper root-free interval for cographic matroids. For planar graphs this would imply the Birkoff-Lewis conjecture. However, Gordon Royle found counterexamples to this conjecture by looking at a family of graphs called generalised Petersen graphs. Based on the examples he found for which he could calculate the real roots, he modified Welsh’s conjecture, changing the 4 to a 5, as “$(5,\infty)$ is an upper root-free interval for cographic matroids”. However, this conjecture turned out to also be false, as proved by Jesus Salas and Jesper Jacobsen, who managed to show that some large generalised Petersen graph has real flow roots slightly over 5. Incidentally, in July I went to Royal Holloway to attend the Workshop on New Directions for the Tutte Polynomial and I saw Jesus Salas give a talk on this. You can have a look at his slides on the conference page. So now the question remains of whether cographic matroids do have an upper root-free interval, and if so, what the interval is.


[O78] J. G. Oxley, Colouring, packing and the critical problem, Quart. J. Math. Oxford Ser. (2), 29(113), pp 11-22, 1978.

[OW79] J. G. Oxley and D. J. A. Welsh, The Tutte polynomial and percolation, Graph Theory and Related Topics (eds. J. A. Bondy and U. S. R. Murty), pp. 329-339, Academic Press, London, 1979.

[EHJ98] H. Edwards, R. Hierons, and B. Jackson, The zero-free intervals for characteristic polynomials of matroids, Combin. Probab. Comput., 7(2), pp. 153-165, 1998.

[JS13] J. L. Jacobsen and Jesús Salas, Is the 5-flow conjecture almost false?, Journal of Comb. Theory Series B, 103(4), pp. 532-565, 2013.


The Matroid Secretary Problem

In this post, I am going to discuss the matroid secretary problem, which is a very nice problem introduced by Babaioff, Immorlica, and Kleinberg [1].  I will try to give an up-to-date account, but am far from an expert in this area, so please feel free to comment if I miss or muddle anything.

Let’s warm up with the classical secretary problem, which has the following setup.  We want to hire a secretary.  There is a set $X$ of $n$ candidates, and each $x \in X$ has a competency $w(x)$.  We know that there are $n$ candidates, but we do not know the competency function.  The secretaries are then presented to us in a random order.  Once a secretary is presented to us, we interview him and discover his competence.  We then have to make an irrevocable decision to hire him or not.  If we hire him on the spot, the process ends.  If not, then due to a hyper-competitive labour market, he will be hired by another firm, and we must move on to the next candidate.

Let OPT be the maximum competency of all secretaries.  Our goal is to devise an algorithm that hires a secretary with competency close to OPT.  Say that an algorithm $\mathcal A$ is $\alpha$-competitive if OPT / $\mathbb{E} (\mathcal A) \leq \alpha$, where $\mathbb{E} (\mathcal A)$ is the expected competency outputted by $\mathcal A$ for a random permutation $\sigma$ of $X$.

Here is a $4$-competitive algorithm for the classical secretary problem.  We reject each of first $\frac{n}{2}$ candidates but we keep track of the highest competency, say $h$, of the first $\frac{n}{2}$ candidates.  We then hire the first candidate with competency at least $h$ (if none exists, we just hire the last secretary).  This algorithm is $4$-competitive because the probability that the most competent secretary is in the second half and the second most competent secretary is in the first half is more than $\frac{1}{4}$.  Interestingly, if we instead reject $\frac{1}{e}$ of the initial candidates, we obtain an $e$-competitive algorithm, which turns out to be best possible over all possible algorithms [2].

The matroid secretary problem has the same setup as above, except that there is a matroid $\mathcal M$ on the underlying set $X$ of secretaries.  We now want to hire a set of secretaries, subject to the condition that our hired set is independent in $\mathcal M$.  Again, there is an unknown weight function $w:X \to \mathbb R_+$, and the secretaries are presented to us in a random order.  After interviewing $x$, we must make an irrevocable decision to add or not add $x$ to our currently constructed independent set $I$.  Again, the goal is to devise an algorithm whose expected output is close to the maximum weight independent set.

Note that we recover the classical secretary problem when $\mathcal M$ is a rank-$1$ uniform matroid.  The generalization to matroids might seem like abstract nonsense, but the matroidal version is actually relevant in the theory of auctions, and has garnered a lot of interest.  The big (and still open) problem is the following conjecture.

Conjecture 1 (Babaioff, Immorlica, and Kleinberg [1]).  For every matroid $\mathcal M$, there is a $O(1)$-competitive algorithm.

Using a clever modification of the threshold price algorithm that we discussed for the classical secretary problem, Babaioff, Immorlica, and Kleinberg [1] proved that there is a $O(\log r)$-competitive algorithm, where $r$ is the rank of $\mathcal M$.  In a breakthrough paper, Chakraborty and Lachish [3] devised a $O(\sqrt{ \log r})$-competitive algorithm.  Their algorithm is a patchwork of a few different algorithms, and is quite complicated.  Finally, the state-of-the-art is a $O( \log \log r)$-competitive algorithm of Lachish [4].  Using different tools, Feldman, Svensson, and Zenklusen [5] have also obtained a $O( \log \log r)$-competitive algorithm for general matroids.

Another line of research is to weaken the problem slightly, in the hope of obtaining a constant-competitive algorithm.  Perhaps the most important modification is known as the random assignment model.  Note that in the original matroid secretary problem, we may as well assume that the weight function is chosen by an adversary.  In the random assignment model, we weaken the adversary, by only allowing her to choose the set of weights.  The weights are then randomly assigned to the set of secretaries.  Soto [6] proved that there is a constant-competitive algorithm for all matroids in the random assignment model.

Theorem 2 (Soto [6]). For each matroid $\mathcal M$, there is a $O(1)$-competitive algorithm in the random assignment model.

Soto’s algorithm uses the classic decomposition of a matroid into its principal minors.  See the recent paper of Fujishige [7] for a survey of this theory.  The principal minors of a matroid are uniformly dense ($\mathcal M$ is uniformly dense if $\max_{A \subseteq E} \frac{|A|}{r(A)}$ is obtained by $E$). Using the decomposition, one can reduce to the case of uniformly dense matroids, and Soto proved that there is indeed a $O(1)$-competitive algorithm for uniformly dense matroids. Note that his proof crucially assumes that we are in the random assignment model.

There are also many other interesting variants of the original matroid secretary problem. See Section 3 of Dinitz [8] for a nice overview.

I will finish by discussing the original matroid secretary problem for restricted classes of matroids.  In [1], it is proved that Conjecture 1 holds for graphic matroids, uniform matroids, partition matroids, and bounded-degree transversal matroids.  The bounded-degree condition for transversal matroids was later removed by Dmitrov and Plaxton [9].

Here is another class of matroids for which Conjecture 1 holds.  Let $\mathcal F$ be a laminar family and $c: \mathcal F \to \mathbb{N}$.  If we let $\mathcal I$ be the set of all $I$ such that $|I \cap F| \leq c(F)$ for all $F \in \mathcal F$, then $\mathcal I$ is the set of independent sets of a matroid.  Matroids arising in this way are called laminar matroids.  Note that the class of laminar matroids contains the partition matroids.  Im and Wang [10] showed that there is a constant-competitive matroid secretary algorithm for the class of laminar matroids.

Finally, Dinitz and Kortsarz gave a $O(1)$-competitive algorithm for the matroid secretary problem on regular matroids.  Their proof uses Seymour’s decomposition theorem for regular matroids [11].  Note that graphic matroids, cographic matroids, and $R_{10}$ all have $O(1)$-competitive matroid secretary algorithms.

Using the structure theorem for $\mathbb F$-representable matroids proved by Geelen, Gerards and Whittle [12], it may be possible to prove the following special case of Conjecture 1.

Conjecture 3.  For every finite field $\mathbb F$, there is a $O(1)$-competitive algorithm for the matroid secretary problem on the class of $\mathbb F$-representable matroids.

I suspect this might be tricky since one basic class of $\mathbb F$-representable matroids are those representable over a subfield $\mathbb F’$ of $\mathbb F$, and I don’t see how to get a $O(1)$-competitive matroid secretary algorithm for  $\mathbb F’$-representable matroids unless we are doing some cunning induction.

On the other hand, the structure theorem for binary matroids is slightly simpler (due to the absence of subfields), so the following special case of Conjecture 3 may be doable.

Conjecture 4. There is a $O(1)$-competitive algorithm for the matroid secretary problem on binary matroids.


[1] Moshe Babaioff, Nicole Immorlica, and Robert Kleinberg. Matroids, secretary problems, and online mechanisms. In Proc. SODA, pages 434–443, 2007.

[2] E. B. Dynkin. The optimum choice of the instant for stopping a Markov process. Soviet Math. Dokl, 4, 1963.

[3] Sourav Chakraborty and Oded Lachish. Improved competitive ratio for the matroid secretary problem. In Proc. SODA, pages 1702–1712, 2012.

[4] Lachish, Oded. O(log log rank)-competitive ratio for the matroid secretary problem. Foundations of Computer Science (FOCS), 2014 IEEE 55th Annual Symposium on. IEEE, 2014.

[5] Feldman, Moran, Ola Svensson, and Rico Zenklusen.  A simple O(log log (rank))-competitive algorithm for the matroid secretary problem.  Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms. SIAM, 2015.

[6] José A. Soto. Matroid secretary problem in the random assignment model. In Proc. SODA, pages 1275–1284, 2011.

[7] S. Fujishige. Theory of principal partitions revisited. In Research Trends in Combinatorial Optimization, pages 127–162, 2009.

[8] Dinitz, Michael. Recent advances on the matroid secretary problem. ACM SIGACT News 44 (2013), no. 2, 126–142.

[9] Nedialko B. Dimitrov and C. Greg Plaxton. Competitive weighted matching in transversal matroids. In Proc. ICALP, pages 397–408, 2008.

[10] Sungjin Im and Yajun Wang. Secretary problems: laminar matroid and interval scheduling. In Proc. SODA, pages 1265–1274, 2011.

[11] P. D. Seymour. Decomposition of regular matroids. J. Combin. Theory Ser. B, 28(3):305–359, 1980.

[12] J. Geelen, B. Gerards, G. Whittle. Structure in minor-closed-classes of matroids. Surveys in Combinatorics, London Mathematical Society Lecture Note Series 409, 327–362, 2013.