<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd">
<article article-type="research-article" dtd-version="3.0" xml:lang="en" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">
<front>
<journal-meta>
<journal-id journal-id-type="nlm-ta">PLoS ONE</journal-id>
<journal-id journal-id-type="publisher-id">plos</journal-id>
<journal-id journal-id-type="pmc">plosone</journal-id>
<journal-title-group>
<journal-title>PLOS ONE</journal-title>
</journal-title-group>
<issn pub-type="epub">1932-6203</issn>
<publisher>
<publisher-name>Public Library of Science</publisher-name>
<publisher-loc>San Francisco, CA USA</publisher-loc>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="publisher-id">PONE-D-15-36538</article-id>
<article-id pub-id-type="doi">10.1371/journal.pone.0147935</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Research Article</subject>
</subj-group>
<subj-group subj-group-type="Discipline-v3"><subject>Computer and information sciences</subject><subj-group><subject>Data visualization</subject><subj-group><subject>Infographics</subject><subj-group><subject>Graphs</subject></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Physical sciences</subject><subj-group><subject>Mathematics</subject><subj-group><subject>Probability theory</subject><subj-group><subject>Markov models</subject></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Physical sciences</subject><subj-group><subject>Mathematics</subject><subj-group><subject>Algebra</subject><subj-group><subject>Polynomials</subject></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Research and analysis methods</subject><subj-group><subject>Mathematical and statistical techniques</subject><subj-group><subject>Mathematical models</subject><subj-group><subject>Random walk</subject></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Physical sciences</subject><subj-group><subject>Mathematics</subject><subj-group><subject>Probability theory</subject><subj-group><subject>Probability distribution</subject></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Physical sciences</subject><subj-group><subject>Mathematics</subject><subj-group><subject>Algebra</subject><subj-group><subject>Linear algebra</subject><subj-group><subject>Eigenvalues</subject></subj-group></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Computer and information sciences</subject><subj-group><subject>Network analysis</subject></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Physical sciences</subject><subj-group><subject>Mathematics</subject><subj-group><subject>Applied mathematics</subject><subj-group><subject>Algorithms</subject></subj-group></subj-group></subj-group></subj-group><subj-group subj-group-type="Discipline-v3"><subject>Research and analysis methods</subject><subj-group><subject>Simulation and modeling</subject><subj-group><subject>Algorithms</subject></subj-group></subj-group></subj-group></article-categories>
<title-group>
<article-title><italic>Marathon</italic>: An Open Source Software Library for the Analysis of Markov-Chain Monte Carlo Algorithms</article-title>
<alt-title alt-title-type="running-head"><italic>Marathon</italic></alt-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes" xlink:type="simple">
<name name-style="western">
<surname>Rechner</surname> <given-names>Steffen</given-names></name>
<xref ref-type="aff" rid="aff001"><sup>1</sup></xref>
<xref ref-type="corresp" rid="cor001">*</xref>
</contrib>
<contrib contrib-type="author" xlink:type="simple">
<name name-style="western">
<surname>Berger</surname> <given-names>Annabell</given-names></name>
<xref ref-type="aff" rid="aff001"><sup>1</sup></xref>
<xref ref-type="aff" rid="aff002"><sup>2</sup></xref>
</contrib>
</contrib-group>
<aff id="aff001">
<label>1</label>
<addr-line>Institute of Computer Science, Martin Luther University Halle-Wittenberg, Halle (Saale), Germany</addr-line>
</aff>
<aff id="aff002">
<label>2</label>
<addr-line>German Centre of Integrative Biodiversity Research (idiv) Halle-Jena-Leipzig, Leipzig, Germany</addr-line>
</aff>
<contrib-group>
<contrib contrib-type="editor" xlink:type="simple">
<name name-style="western">
<surname>Kestler</surname> <given-names>Hans A</given-names></name>
<role>Editor</role>
<xref ref-type="aff" rid="edit1"/>
</contrib>
</contrib-group>
<aff id="edit1">
<addr-line>University of Ulm, GERMANY</addr-line>
</aff>
<author-notes>
<fn fn-type="conflict" id="coi001">
<p>The authors have declared that no competing interests exist.</p>
</fn>
<fn fn-type="con" id="contrib001">
<p>Conceived and designed the experiments: SR AB. Performed the experiments: SR. Analyzed the data: SR AB. Contributed reagents/materials/analysis tools: SR. Wrote the paper: SR AB. Designed the software: SR.</p>
</fn>
<corresp id="cor001">* E-mail: <email xlink:type="simple">steffen.rechner@informatik.uni-halle.de</email></corresp>
</author-notes>
<pub-date pub-type="collection">
<year>2016</year>
</pub-date>
<pub-date pub-type="epub">
<day>29</day>
<month>1</month>
<year>2016</year>
</pub-date>
<volume>11</volume>
<issue>1</issue>
<elocation-id>e0147935</elocation-id>
<history>
<date date-type="received">
<day>19</day>
<month>8</month>
<year>2015</year>
</date>
<date date-type="accepted">
<day>11</day>
<month>1</month>
<year>2016</year>
</date>
</history>
<permissions>
<copyright-year>2016</copyright-year>
<copyright-holder>Rechner, Berger</copyright-holder>
<license xlink:href="http://creativecommons.org/licenses/by/4.0/" xlink:type="simple">
<license-p>This is an open access article distributed under the terms of the <ext-link ext-link-type="uri" xlink:href="http://creativecommons.org/licenses/by/4.0/" xlink:type="simple">Creative Commons Attribution License</ext-link>, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.</license-p>
</license>
</permissions>
<self-uri content-type="pdf" xlink:href="info:doi/10.1371/journal.pone.0147935"/>
<abstract>
<p>We present the software library <italic>marathon</italic>, which is designed to support the analysis of sampling algorithms that are based on the Markov-Chain Monte Carlo principle. The main application of this library is the computation of properties of so-called state graphs, which represent the structure of Markov chains. We demonstrate applications and the usefulness of <italic>marathon</italic> by investigating the quality of several bounding methods on four well-known Markov chains for sampling perfect matchings and bipartite graphs. In a set of experiments, we compute the total mixing time and several of its bounds for a large number of input instances. We find that the upper bound gained by the famous canonical path method is often several magnitudes larger than the total mixing time and deteriorates with growing input size. In contrast, the spectral bound is found to be a precise approximation of the total mixing time.</p>
</abstract>
<funding-group>
<funding-statement>The authors have no support or funding to report.</funding-statement>
</funding-group>
<counts>
<fig-count count="11"/>
<table-count count="0"/>
<page-count count="22"/>
</counts>
<custom-meta-group>
<custom-meta id="data-availability">
<meta-name>Data Availability</meta-name>
<meta-value>Source code is available at <ext-link ext-link-type="uri" xlink:href="https://github.com/srechner/marathon" xlink:type="simple">https://github.com/srechner/marathon</ext-link>.</meta-value>
</custom-meta>
</custom-meta-group>
</article-meta>
</front>
<body>
<sec id="sec001" sec-type="intro">
<title>Introduction</title>
<p>The task of random sampling is to return a randomly selected object from a typically large set of objects according to a specified probability distribution. Such tasks often arise in practical applications like network analysis, where properties of a certain network of interest are to be compared with those of a random null model network [<xref ref-type="bibr" rid="pone.0147935.ref001">1</xref>, <xref ref-type="bibr" rid="pone.0147935.ref002">2</xref>]. Another application is approximate counting of combinatorial objects. While this is typically a hard problem, the number of solutions of a <italic>self-reducible</italic> problem, however, can be approximated in polynomial time using randomly sampled objects [<xref ref-type="bibr" rid="pone.0147935.ref003">3</xref>]. We consider sampling methods which follow the so-called <italic>Markov-Chain Monte Carlo</italic> (MCMC) approach. A MCMC algorithm can be considered as a <italic>random walk</italic> on a directed graph where the vertices of this graph correspond to the set of objects to be sampled from. Starting at an arbitrary vertex, we go to a randomly chosen adjacent vertex and continue our random walk from this vertex; after some time, we stop the random walk. The object representing the final vertex is returned as a random sample. An overview of the surprisingly versatile applications of the MCMC approach was given by Diaconis [<xref ref-type="bibr" rid="pone.0147935.ref004">4</xref>].</p>
<sec id="sec002">
<title>Motivation</title>
<p>In general, an infinite number of steps will lead to a truly random sample. But what happens if we stop the random walk after a finite number of steps? The number of steps which are necessary to sample from a probability distribution which is <italic>close</italic> to the desired distribution is known as the <italic>total mixing time</italic> of a Markov chain, and is of central interest for the applicability of an MCMC algorithm. There are several methods which are able to gain upper bounds on the total mixing time like the <italic>canonical path</italic> method. Sinclair [<xref ref-type="bibr" rid="pone.0147935.ref005">5</xref>] gives an excellent overview about different bounding techniques. Sometimes, such bounding methods can successfully be applied to Markov Chains to gain upper bounds on their total mixing times. When applied successfully, such upper bounds most often are high-degree polynomials on the size of the input. This is far too large to be applicable in practice, where more than a linear number of steps is infeasible for large input size. In fact, software tools like <italic>mfinder</italic> [<xref ref-type="bibr" rid="pone.0147935.ref001">1</xref>], which can be used for motif search in large networks, use a MCMC sampling approach with a linear number of steps as default for generation of null models. This leads to the problem that the sampling result might not be as random as desired, resulting in a non-optimal or even incorrect behaviour of the application.</p>
<p>On the other hand, it may be the case that upper bounds on the total mixing time are just too pessimistic. From a purely theoretical perspective it is often already a breakthrough to establish that a given Markov chain is rapidly mixing, that is, to establish a polynomial mixing time bound. Since the bounding techniques in Markov chain analysis are often fairly general and worst-case instances in terms of total mixing time are not known, it is not clear, whether the upper bounds gained by such methods are tight for some worst-case instance. However, for practical applicability, it is of eminent importance to find as sharp bounds as possible. Up to now, there is very little knowledge about the gap between the so established upper bounds and tight bounds for actual worst-case instances. Probably most researches in this field will suspect that a considerable real gap exists, but for specific Markov chains it is in general completely open how many orders of magnitude this gap may be large. By this reason, we believe that the true total mixing time might be much lower than proven by theoretical methods. Therefore, our working questions are: a) Is the total mixing time really as large as the bounding methods propose, or is it possible that the bounding methods are just not precise enough to capture the real total mixing time? b) Which bounding method has the best potential and could lead to better results when further information about the structure of state graphs is given?</p>
</sec>
<sec id="sec003">
<title>Contribution</title>
<p>In trying to answer these questions, we developed the <italic>C++</italic> library <italic>marathon</italic>, which has been designed to compute several structural properties of Markov chains and its corresponding state graphs. The library offers the following features:</p>
<list list-type="bullet">
<list-item>
<p>Construction of state graphs from arbitrary input instances for a set of user-definable transition rules.</p>
</list-item>
<list-item>
<p>Computation of structural properties of state graphs.
<list list-type="bullet">
<list-item>
<p>Computation of the total mixing time for arbitrary <italic>ϵ</italic>.</p>
</list-item>
<list-item>
<p>Computation of the congestion bound gained by the canonical path method with an arbitrary, user-definable, path construction scheme.</p>
</list-item>
<list-item>
<p>Computation of the upper and lower spectral bound.</p>
</list-item>
<list-item>
<p>Computation of network properties like diameter and average path length.</p>
</list-item>
</list></p></list-item>
</list>
<p specific-use="continuation">We built this library to easily add algorithms for network analysis. We expect that our library could be helpful both for theoretical scientists as well as for practitioners, who implement MCMC algorithms and have to choose an appropriate number of steps.</p>
<p>As a demonstration on what kind of research can be done with the help of <italic>marathon</italic>, we analysed structural properties and investigated the quality of the total mixing time bounds on the example of four well-known Markov chains. From our experiments, we gained several insights.</p>
<list list-type="bullet">
<list-item>
<p>We found that the congestion bound is multiple times larger than the corresponding total mixing time for almost all instances. In addition, the quality of the congestion bound deteriorates with growing input size. This indicates that the congestion bounds are bad approximations of the total mixing time, and, since this bound is often used for theoretical analysis, that the high-degree polynomial bounds from theory may be too pessimistic.</p>
</list-item>
<list-item>
<p>In contrast, the upper spectral bound is close to the total mixing time for all observations. Even if its quality also deteriorates with growing instance size, the spectral bounds keeps close to the total mixing time much longer than the congestion bound.</p>
</list-item>
<list-item>
<p>The lower spectral bound can be used as a very good approximation for all input instances we investigated in this work. The data suggests an almost linear relationship between the lower spectral bound and total mixing time.</p>
</list-item>
<list-item>
<p>We figured out several new structural insights about the Markov chains we investigated. For example, we found that the the second largest eigenvalue in magnitude is almost always positive. The total mixing time of instances of the same input size can be very diverse and depends on the vertex degree in the state graphs. This shows that the experimental approach provided by our library may lead to structural insights which may be useful to get new intuitions for developing more precise bounding techniques.</p>
</list-item>
</list>
<p specific-use="continuation">From our experiments we can conclude that the canonical path method will not lead to tight bounds of the total mixing time, even when further information about a state graphs structure is included. Instead, developing new methods based on the spectral gap seems to be more promising.</p>
</sec>
<sec id="sec004">
<title>Structure</title>
<p>The remainder of this article is structured as follows: In the next section we give a brief introduction into the theory of Markov chains, in particular, in the concepts of total mixing time and its bounds. Thereafter, we present the main features of the <italic>marathon</italic> library. In the second part of this article, we demonstrate the applicability of the library in a set of experiments, while trying to answer the questions described above. The results of these experiments are shown and discussed in the final section.</p>
</sec>
</sec>
<sec id="sec005" sec-type="materials|methods">
<title>Methods and Materials</title>
<p>An important tool for understanding MCMC based sampling processes are Markov chains. To make the following sections more understandable, we will briefly introduce the most important concepts of the theory of Markov chains. For a less steep introduction into the topic, we recommend the lecture notes of Sinclair [<xref ref-type="bibr" rid="pone.0147935.ref006">6</xref>], the textbook by Levin, Peres and Wilmer [<xref ref-type="bibr" rid="pone.0147935.ref007">7</xref>], and the survey of Lovász [<xref ref-type="bibr" rid="pone.0147935.ref008">8</xref>].</p>
<sec id="sec006">
<title>Theory of Markov Chains</title>
<p>A Markov chain can be seen as a random walk on a set Ω of combinatorial objects, the so-called <italic>states</italic>. Two states <italic>x</italic>, <italic>y</italic> ∈ Ω can be connected via a <italic>transition arc</italic> (<italic>x</italic>, <italic>y</italic>)∈Ψ, when <italic>x</italic> can be transformed into <italic>y</italic> via small local changes. This definition induces a so-called <italic>state graph</italic> Γ = (Ω, Ψ), representing the objects and their adjacencies. We define for each pair of states <italic>x</italic>, <italic>y</italic> ∈ Ω the so-called <italic>proposal probability</italic> <italic>κ</italic>: Ω × Ω → [0, 1] and a <italic>weight function</italic> <inline-formula id="pone.0147935.e001"><alternatives><graphic id="pone.0147935.e001g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e001" xlink:type="simple"/><mml:math display="inline" id="M1"><mml:mrow><mml:mi>w</mml:mi><mml:mo>:</mml:mo><mml:mspace width="1pt"/><mml:mo>Ω</mml:mo><mml:mspace width="1pt"/><mml:mo>→</mml:mo><mml:mspace width="1pt"/><mml:msup><mml:mi>ℝ</mml:mi><mml:mo>+</mml:mo></mml:msup></mml:mrow></mml:math></alternatives></inline-formula>. A step from <italic>x</italic> to <italic>y</italic> in a random walk is done with <italic>transition probability</italic> <italic>P</italic>(<italic>x</italic>, <italic>y</italic>) = <italic>κ</italic>(<italic>x</italic>, <italic>y</italic>) ⋅ min(1, <italic>w</italic>(<italic>y</italic>)/<italic>w</italic>(<italic>x</italic>)). The matrix <italic>P</italic> = (<italic>P</italic>(<italic>x</italic>, <italic>y</italic>)<sub><italic>x</italic>, <italic>y</italic> ∈ Ω</sub>) is called <italic>transition matrix</italic>.</p>
<p>Algorithm 1 shows the classical random walk based sampling method. A random state <italic>b</italic> ∈ Ω is returned, sampled from a probability distribution <inline-formula id="pone.0147935.e002"><alternatives><graphic id="pone.0147935.e002g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e002" xlink:type="simple"/><mml:math display="inline" id="M2"><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup></mml:math></alternatives></inline-formula> which describes a state’s probability after <italic>t</italic> steps when starting at state <italic>a</italic> ∈ Ω. The <italic>fundamental theorem for Markov chains</italic> (see for example [<xref ref-type="bibr" rid="pone.0147935.ref007">7</xref>]) says that the distribution <inline-formula id="pone.0147935.e003"><alternatives><graphic id="pone.0147935.e003g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e003" xlink:type="simple"/><mml:math display="inline" id="M3"><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup></mml:math></alternatives></inline-formula> converges for <italic>t</italic> → ∞ to the unique <italic>stationary distribution</italic> <italic>π</italic> with <inline-formula id="pone.0147935.e004"><alternatives><graphic id="pone.0147935.e004g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e004" xlink:type="simple"/><mml:math display="inline" id="M4"><mml:mrow><mml:mi>π</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>y</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>=</mml:mo> <mml:mfrac><mml:mrow><mml:mi>w</mml:mi> <mml:mo>(</mml:mo> <mml:mi>y</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:msub><mml:mo>∑</mml:mo> <mml:mrow><mml:mi>x</mml:mi> <mml:mo>∈</mml:mo> <mml:mi>Ω</mml:mi></mml:mrow></mml:msub> <mml:mi>w</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>x</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:mrow></mml:mfrac></mml:mrow></mml:math></alternatives></inline-formula> for all <italic>y</italic> ∈ Ω and initial states <italic>a</italic> ∈ Ω, if the state graph Γ is non-bipartite, connected and <italic>reversible</italic> with respect to <italic>π</italic>, i.e. <italic>π</italic>(<italic>x</italic>)<italic>P</italic>(<italic>x</italic>, <italic>y</italic>) = <italic>π</italic>(<italic>y</italic>)<italic>P</italic>(<italic>y</italic>, <italic>x</italic>) for each pair of states <italic>x</italic>, <italic>y</italic> ∈ Ω. Markov chains which fulfil these properties are called <italic>ergodic</italic>.</p>
<p><bold>Algorithm 1</bold> Random Walk</p>
<p specific-use="line"><bold>Input</bold>: State <italic>a</italic> ∈ Ω, number <italic>t</italic> of steps.</p>
<p specific-use="line"><bold>Output</bold>: State <italic>b</italic> ∈ Ω, according to probability distribution <inline-formula id="pone.0147935.e005"><alternatives><graphic id="pone.0147935.e005g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e005" xlink:type="simple"/><mml:math display="inline" id="M5"><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup></mml:math></alternatives></inline-formula>.</p>
<p specific-use="line">1: <italic>x</italic> ← <italic>a</italic></p>
<p specific-use="line">2: <bold>for</bold> <italic>i</italic> ← 1 <bold>to</bold> <italic>t</italic> <bold>do</bold></p>
<p specific-use="line">3: <bold>Neighbour selection</bold>: Pick a neighbour <italic>y</italic> of <italic>x</italic> with probability <italic>κ</italic>(<italic>x</italic>, <italic>y</italic>).</p>
<p specific-use="line">4: <bold>Metropolis rule</bold>: <italic>x</italic> ← <italic>y</italic> with probability <inline-formula id="pone.0147935.e006"><alternatives><graphic id="pone.0147935.e006g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e006" xlink:type="simple"/><mml:math display="inline" id="M6"><mml:mrow><mml:mo form="prefix" movablelimits="true">min</mml:mo> <mml:mo>(</mml:mo> <mml:mn>1</mml:mn> <mml:mo>,</mml:mo> <mml:mfrac><mml:mrow><mml:mi>w</mml:mi> <mml:mo>(</mml:mo> <mml:mi>y</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mi>w</mml:mi> <mml:mo>(</mml:mo> <mml:mi>x</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:mfrac> <mml:mo>)</mml:mo> <mml:mo>.</mml:mo></mml:mrow></mml:math></alternatives></inline-formula></p>
<p specific-use="line">5: <bold>end for</bold></p>
<p specific-use="line">6: <bold>return</bold> <italic>x</italic></p>
<sec id="sec007">
<title>Total Mixing Time</title>
<p>The <italic>total variation distance</italic> measures the distance between two probability distributions <italic>μ</italic> and <italic>η</italic>:
<disp-formula id="pone.0147935.e007"><alternatives><graphic id="pone.0147935.e007g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e007" xlink:type="simple"/><mml:math display="block" id="M7"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo> <mml:mi>μ</mml:mi></mml:mrow> <mml:mo>-</mml:mo> <mml:mrow><mml:mi>η</mml:mi> <mml:mo>|</mml:mo> <mml:mo>|</mml:mo> <mml:mo>:</mml:mo></mml:mrow> <mml:mo>=</mml:mo> <mml:mfrac><mml:mn>1</mml:mn> <mml:mn>2</mml:mn></mml:mfrac> <mml:munder><mml:mo>∑</mml:mo> <mml:mrow><mml:mi>x</mml:mi> <mml:mo>∈</mml:mo> <mml:mo>Ω</mml:mo></mml:mrow></mml:munder> <mml:mrow><mml:mo>|</mml:mo> <mml:mi>μ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>x</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>-</mml:mo> <mml:mi>η</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>x</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>|</mml:mo></mml:mrow> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(1)</label></disp-formula>
We define <inline-formula id="pone.0147935.e008"><alternatives><graphic id="pone.0147935.e008g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e008" xlink:type="simple"/><mml:math display="inline" id="M8"><mml:mrow><mml:msub><mml:mi>τ</mml:mi> <mml:mi>a</mml:mi></mml:msub> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>:</mml:mo> <mml:mo>=</mml:mo> <mml:mrow><mml:mo form="prefix" movablelimits="true">min</mml:mo> <mml:mo>{</mml:mo> <mml:mi>t</mml:mi> <mml:mo>∈</mml:mo> <mml:mi mathvariant="double-struck">N</mml:mi> <mml:mo lspace="0pt">:</mml:mo> <mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mrow><mml:mo>-</mml:mo> <mml:mi>π</mml:mi> <mml:mo>|</mml:mo> <mml:mo>|</mml:mo> <mml:mo>≤</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>}</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> as the minimal number of steps a random walk has to take to reach a distribution which is close to <italic>ϵ</italic> to its stationary distribution when starting at state <italic>a</italic> ∈ Ω. The <italic>total mixing time</italic> <italic>τ</italic>(<italic>ϵ</italic>) of a Markov chain is defined as
<disp-formula id="pone.0147935.e009"><alternatives><graphic id="pone.0147935.e009g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e009" xlink:type="simple"/><mml:math display="block" id="M9"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>:</mml:mo> <mml:mo>=</mml:mo> <mml:munder><mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mrow><mml:mi>a</mml:mi> <mml:mo>∈</mml:mo> <mml:mo>Ω</mml:mo></mml:mrow></mml:munder> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>τ</mml:mi> <mml:mi>a</mml:mi></mml:msub> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>}</mml:mo></mml:mrow> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(2)</label></disp-formula>
A Markov chain is known as <italic>rapidly mixing</italic>, if <italic>τ</italic>(<italic>ϵ</italic>) can be bounded from above by a polynomial which depends on the input size <italic>n</italic> and the parameter <italic>ϵ</italic><sup>−1</sup>. The total mixing time can be bounded by several techniques. We briefly present two widely used bounding methods which we investigate in the remainder of this article.</p>
</sec>
<sec id="sec008">
<title>Spectral Bound</title>
<p>Let 1 = <italic>λ</italic><sub>1</sub> &gt; <italic>λ</italic><sub>2</sub> ≥ … ≥ <italic>λ</italic><sub>|Ω|</sub> &gt; −1 be the real eigenvalues of the transition matrix <italic>P</italic> and let <italic>λ</italic><sub>max</sub> be defined as <italic>λ</italic><sub>max</sub> = max{|<italic>λ</italic><sub>2</sub>|, |<italic>λ</italic><sub>Ω</sub>|}. The total mixing time can be bounded by the lower and upper <italic>spectral bound</italic>[<xref ref-type="bibr" rid="pone.0147935.ref005">5</xref>], i.e.,
<disp-formula id="pone.0147935.e010"><alternatives><graphic id="pone.0147935.e010g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e010" xlink:type="simple"/><mml:math display="block" id="M10"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:mtd> <mml:mtd><mml:mo>≤</mml:mo></mml:mtd> <mml:mtd columnalign="left"><mml:mrow><mml:msup><mml:mfenced close=")" open="(" separators=""><mml:mn>1</mml:mn> <mml:mo>-</mml:mo> <mml:msub><mml:mi>λ</mml:mi> <mml:mo form="prefix" movablelimits="true">max</mml:mo></mml:msub></mml:mfenced> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>·</mml:mo> <mml:mfenced close=")" open="(" separators=""><mml:mo form="prefix">ln</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:msup><mml:mi>ϵ</mml:mi> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>+</mml:mo> <mml:mo form="prefix">ln</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:msubsup><mml:mi>π</mml:mi> <mml:mrow><mml:mo form="prefix" movablelimits="true">min</mml:mo></mml:mrow> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msubsup> <mml:mo>)</mml:mo></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(3)</label></disp-formula> <disp-formula id="pone.0147935.e011"><alternatives><graphic id="pone.0147935.e011g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e011" xlink:type="simple"/><mml:math display="block" id="M11"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:mtd> <mml:mtd><mml:mo>≥</mml:mo></mml:mtd> <mml:mtd columnalign="left"><mml:mrow><mml:mfrac><mml:mn>1</mml:mn> <mml:mn>2</mml:mn></mml:mfrac> <mml:msub><mml:mi>λ</mml:mi> <mml:mo form="prefix" movablelimits="true">max</mml:mo></mml:msub> <mml:msup><mml:mrow><mml:mo>(</mml:mo> <mml:mn>1</mml:mn> <mml:mo>-</mml:mo> <mml:msub><mml:mi>λ</mml:mi> <mml:mo form="prefix" movablelimits="true">max</mml:mo></mml:msub> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo form="prefix">ln</mml:mo> <mml:msup><mml:mrow><mml:mo>(</mml:mo> <mml:mn>2</mml:mn> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(4)</label></disp-formula>
where <italic>π</italic><sub><italic>min</italic></sub> denotes the smallest component of <italic>π</italic>. The transition matrix <italic>P</italic> is not necessarily symmetric. However, it can be transformed into a symmetrical matrix:
<disp-formula id="pone.0147935.e012"><alternatives><graphic id="pone.0147935.e012g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e012" xlink:type="simple"/><mml:math display="block" id="M12"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:msub><mml:mi>P</mml:mi> <mml:mrow><mml:mi>s</mml:mi> <mml:mi>y</mml:mi> <mml:mi>m</mml:mi></mml:mrow></mml:msub> <mml:mo>=</mml:mo> <mml:msup><mml:mi>D</mml:mi> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn> <mml:mo>/</mml:mo> <mml:mn>2</mml:mn></mml:mrow></mml:msup> <mml:mo>·</mml:mo> <mml:mi>P</mml:mi> <mml:mo>·</mml:mo> <mml:msup><mml:mi>D</mml:mi> <mml:mrow><mml:mn>1</mml:mn> <mml:mo>/</mml:mo> <mml:mn>2</mml:mn></mml:mrow></mml:msup> <mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(5)</label></disp-formula>
where <italic>D</italic> is the |Ω| × |Ω| diagonal matrix with the components of <italic>π</italic> on its main diagonal. This transformation relies on the reversibility of a Markov chain. It is a classical result that <italic>P</italic><sub><italic>sym</italic></sub> has the same eigenvalues as <italic>P</italic>.</p>
</sec>
<sec id="sec009">
<title>Congestion Bound</title>
<p>Sinclair’s <italic>multi commodity flow method</italic>[<xref ref-type="bibr" rid="pone.0147935.ref005">5</xref>] is often used for bounding the total mixing time. Let <inline-formula id="pone.0147935.e013"><alternatives><graphic id="pone.0147935.e013g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e013" xlink:type="simple"/><mml:math display="inline" id="M13"><mml:mrow><mml:mi mathvariant="script">P</mml:mi> <mml:mo>=</mml:mo> <mml:msub><mml:mo>⋃</mml:mo> <mml:mrow><mml:mi>x</mml:mi> <mml:mo>≠</mml:mo> <mml:mi>y</mml:mi></mml:mrow></mml:msub> <mml:msub><mml:mi mathvariant="script">P</mml:mi> <mml:mrow><mml:mi>x</mml:mi> <mml:mi>y</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></alternatives></inline-formula> be a family of simple paths in Γ, each <inline-formula id="pone.0147935.e014"><alternatives><graphic id="pone.0147935.e014g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e014" xlink:type="simple"/><mml:math display="inline" id="M14"><mml:msub><mml:mi mathvariant="script">P</mml:mi> <mml:mrow><mml:mi>x</mml:mi> <mml:mi>y</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula> consisting of simple paths between <italic>x</italic> and <italic>y</italic> ∈ Ω. The <italic>maximum load congestion</italic> <italic>ρ</italic>, with respect to <inline-formula id="pone.0147935.e015"><alternatives><graphic id="pone.0147935.e015g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e015" xlink:type="simple"/><mml:math display="inline" id="M15"><mml:mi mathvariant="script">P</mml:mi></mml:math></alternatives></inline-formula>, is then defined as
<disp-formula id="pone.0147935.e016"><alternatives><graphic id="pone.0147935.e016g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e016" xlink:type="simple"/><mml:math display="block" id="M16"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>ρ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi mathvariant="script">P</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>=</mml:mo> <mml:munder><mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi> <mml:mo>)</mml:mo> <mml:mo>∈</mml:mo> <mml:mo>Ψ</mml:mo></mml:mrow></mml:munder> <mml:mfrac><mml:mrow><mml:msub><mml:mo>∑</mml:mo> <mml:mrow><mml:mi>p</mml:mi> <mml:mo>∈</mml:mo> <mml:mi mathvariant="script">P</mml:mi> <mml:mo lspace="0pt">:</mml:mo> <mml:mo>(</mml:mo> <mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi> <mml:mo>)</mml:mo> <mml:mo>∈</mml:mo> <mml:mi>p</mml:mi></mml:mrow></mml:msub> <mml:mi>π</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>x</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mi>π</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>y</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mo>|</mml:mo> <mml:mi>p</mml:mi> <mml:mo>|</mml:mo></mml:mrow></mml:mrow> <mml:mrow><mml:mi>π</mml:mi> <mml:mo>(</mml:mo> <mml:mi>u</mml:mi> <mml:mo>)</mml:mo> <mml:mi>P</mml:mi> <mml:mo>(</mml:mo> <mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:mfrac> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(6)</label></disp-formula>
For any system of paths <inline-formula id="pone.0147935.e017"><alternatives><graphic id="pone.0147935.e017g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e017" xlink:type="simple"/><mml:math display="inline" id="M17"><mml:mi mathvariant="script">P</mml:mi></mml:math></alternatives></inline-formula> the total mixing time of a reversible Markov chain can be bounded by the <italic>congestion bound</italic>, i.e.,
<disp-formula id="pone.0147935.e018"><alternatives><graphic id="pone.0147935.e018g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e018" xlink:type="simple"/><mml:math display="block" id="M18"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:mtd> <mml:mtd><mml:mo>≤</mml:mo></mml:mtd> <mml:mtd columnalign="left"><mml:mrow><mml:mi>ρ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi mathvariant="script">P</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>·</mml:mo> <mml:mfenced close=")" open="(" separators=""><mml:mo form="prefix">ln</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:msup><mml:mi>ϵ</mml:mi> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>+</mml:mo> <mml:mo form="prefix">ln</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:msubsup><mml:mi>π</mml:mi> <mml:mrow><mml:mo form="prefix" movablelimits="true">min</mml:mo></mml:mrow> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msubsup> <mml:mo>)</mml:mo></mml:mrow></mml:mfenced> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(7)</label></disp-formula>
The quality of the congestion bounds depend on the path construction scheme <inline-formula id="pone.0147935.e019"><alternatives><graphic id="pone.0147935.e019g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e019" xlink:type="simple"/><mml:math display="inline" id="M19"><mml:mi mathvariant="script">P</mml:mi></mml:math></alternatives></inline-formula>. The congestion bound is often used to gain theoretical bounds on the total mixing time.</p>
</sec>
</sec>
<sec id="sec010">
<title>The marathon library</title>
<p>In this section, we introduce the main features of the <italic>marathon</italic> library. Our source code is published under MIT licence and freely available at <ext-link ext-link-type="uri" xlink:href="https://github.com/srechner/marathon" xlink:type="simple">https://github.com/srechner/marathon</ext-link>. To install, just follow the instruction manual at github. Several example programs are available.</p>
<p>The <italic>marathon</italic> library is designed for the study of structural properties of Markov chains, respectively their corresponding state graphs. One of its current main applications is the computation of the total mixing time and several of its bounds. The suggested way to use our library is to implement the transition rules of a Markov chain and conduct some experiments to quickly learn some properties which are typically hard to find in theory. In particular, we allow the computation of the eigenvalue <italic>λ</italic><sub>max</sub> and the application of the canonical path method to compute the congestion bound with some path congestion scheme. This way, one can quickly evaluate whether a scheme captures the total mixing time closely or if there is a noticeable gap. The <italic>marathon</italic> library has been designed with two main goals in mind: Performance and Extensibility. Aiming for the first goal, we use the <italic>C++</italic> programming language, so that various highly efficient third party libraries become available. In particular, we use <italic>CUDA</italic>[<xref ref-type="bibr" rid="pone.0147935.ref009">9</xref>] and <italic>OpenMP</italic>[<xref ref-type="bibr" rid="pone.0147935.ref010">10</xref>] to accelerate compute-intense tasks with the use of multi-core processors and highly parallel graphic processing units. To achieve the second goal, we designed our library for easy extensibility. Our representation of the state graphs is versatile enough to allow the integration of arbitrary graph algorithms. Moreover, we provide interfaces to simplify the programming effort and to hide complexity from the user. For example, adding a new Markov chain is done in a few steps:</p>
<list list-type="order">
<list-item>
<p>Implement a data structure which represents a state, here simply called <monospace>State</monospace>.</p>
</list-item>
<list-item>
<p>Create a class which implements the <monospace>MarkovChain</monospace> interface, using <monospace>State</monospace> as a template parameter. The following virtual methods have to be overridden:
<list list-type="alpha-lower">
<list-item>
<p>The method <monospace>MarkovChain::arbitraryState</monospace>, constructs an arbitrary state from a given input string (e.g. construct a bipartite graph from a given bipartite degree sequence).</p>
</list-item>
<list-item>
<p>The method <monospace>MarkovChain::neighbours</monospace>, takes an object <italic>u</italic> of type <monospace>State</monospace> and creates a list of adjacent states <italic>N</italic><sub><italic>u</italic></sub> whose elements are the result of all valid random choices within <italic>u</italic> plus their corresponding proposal probability <italic>κ</italic>, according to the set of transition rules.</p>
</list-item>
</list>
</p></list-item>
</list>
<p specific-use="continuation">In many cases this can be done within about 200 lines of code with a high amount of re-usability. Example chains have been included within the library. We will now give a detailed description of the algorithmic ideas behind the most important methods available in the library.</p>
<sec id="sec011">
<title>Construction of the State Graph</title>
<p>Given an instance representation (e.g. a degree sequence), the first step of the analysis is the construction of the state graph for the given instance. The purpose of this step is to gain a sparse representation of the state graph Γ = (Ω, Ψ). Initializing Ω with an arbitrary state generated by the <monospace>MarkovChain::arbitraryState</monospace> method, we perform a full graph scan to iteratively enumerate the set of states and transition arcs. In each step, we select a state <italic>u</italic> ∈ Ω and enumerate all its adjacent states <italic>N</italic><sub><italic>u</italic></sub> via the <monospace>MarkovChain::neighbours</monospace> method. We add a transition arc (<italic>u</italic>, <italic>v</italic>) with proposal probability <italic>κ</italic>(<italic>u</italic>, <italic>v</italic>) to Ψ for each adjacent state <italic>v</italic> ∈ <italic>N</italic><sub><italic>u</italic></sub> and add <italic>v</italic> to Ω, if not already included. At the end of this step, we have a complete list Ω of states and an adjacency list representation of the transition arcs Ψ. The probability of each transition (<italic>u</italic>, <italic>v</italic>) ∈ Ψ is subsequently computed as <italic>κ</italic>(<italic>u</italic>, <italic>v</italic>) ⋅ min(1, <italic>w</italic>(<italic>v</italic>)/<italic>w</italic>(<italic>u</italic>)), where the function <inline-formula id="pone.0147935.e020"><alternatives><graphic id="pone.0147935.e020g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e020" xlink:type="simple"/><mml:math display="inline" id="M20"><mml:mrow><mml:mi>w</mml:mi><mml:mo>:</mml:mo><mml:mspace width="1pt"/><mml:mo>Ω</mml:mo><mml:mspace width="1pt"/><mml:mo>→</mml:mo><mml:mspace width="1pt"/><mml:msup><mml:mi>ℝ</mml:mi><mml:mo>+</mml:mo></mml:msup></mml:mrow></mml:math></alternatives></inline-formula> can optionally be overridden to enable the Metropolis rule (see Algorithm 1). The construction of the state graph relies on connectedness of the state graph, which is given whenever the Markov chain is irreducible. The construction of the state graph is a sequential process, consuming <italic>O</italic>(|Ω| + |Ψ|) time and memory.</p>
</sec>
<sec id="sec012">
<title>Computation of the Total Mixing Time</title>
<p>We compute the total mixing time <italic>τ</italic>(<italic>ϵ</italic>) of a state graph based on the following idea: Let <italic>P</italic> be the transition matrix of an ergodic Markov chain and let <italic>a</italic> ∈ Ω be an initial state. One step of the random walk changes the probability distribution <inline-formula id="pone.0147935.e021"><alternatives><graphic id="pone.0147935.e021g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e021" xlink:type="simple"/><mml:math display="inline" id="M21"><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup></mml:math></alternatives></inline-formula> to <inline-formula id="pone.0147935.e022"><alternatives><graphic id="pone.0147935.e022g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e022" xlink:type="simple"/><mml:math display="inline" id="M22"><mml:mrow><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>+</mml:mo> <mml:mn>1</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>=</mml:mo> <mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>·</mml:mo> <mml:mi>P</mml:mi></mml:mrow></mml:math></alternatives></inline-formula>. Iterating this argument, the distribution after <italic>t</italic> steps is given by
<disp-formula id="pone.0147935.e023"><alternatives><graphic id="pone.0147935.e023g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e023" xlink:type="simple"/><mml:math display="block" id="M23"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>=</mml:mo> <mml:msubsup><mml:mi>p</mml:mi> <mml:mrow><mml:mi>a</mml:mi></mml:mrow> <mml:mrow><mml:mo>(</mml:mo> <mml:mn>0</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>·</mml:mo> <mml:msup><mml:mi>P</mml:mi> <mml:mi>t</mml:mi></mml:msup> <mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(8)</label></disp-formula>
where <inline-formula id="pone.0147935.e024"><alternatives><graphic id="pone.0147935.e024g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e024" xlink:type="simple"/><mml:math display="inline" id="M24"><mml:msubsup><mml:mi>p</mml:mi> <mml:mrow><mml:mi>a</mml:mi></mml:mrow> <mml:mrow><mml:mo>(</mml:mo> <mml:mn>0</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup></mml:math></alternatives></inline-formula> is a row vector whose components are <inline-formula id="pone.0147935.e025"><alternatives><graphic id="pone.0147935.e025g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e025" xlink:type="simple"/><mml:math display="inline" id="M25"><mml:mrow><mml:msubsup><mml:mi>p</mml:mi> <mml:mrow><mml:mi>a</mml:mi></mml:mrow> <mml:mrow><mml:mo>(</mml:mo> <mml:mn>0</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>a</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>=</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:math></alternatives></inline-formula> for the initial state <italic>a</italic> and <inline-formula id="pone.0147935.e026"><alternatives><graphic id="pone.0147935.e026g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e026" xlink:type="simple"/><mml:math display="inline" id="M26"><mml:mrow><mml:msubsup><mml:mi>p</mml:mi> <mml:mrow><mml:mi>a</mml:mi></mml:mrow> <mml:mrow><mml:mo>(</mml:mo> <mml:mn>0</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>i</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>=</mml:mo> <mml:mn>0</mml:mn></mml:mrow></mml:math></alternatives></inline-formula>, for <italic>i</italic> ≠ <italic>a</italic>. So, each row of the matrix <italic>P</italic><sup><italic>t</italic></sup> gives the distribution to a certain <inline-formula id="pone.0147935.e027"><alternatives><graphic id="pone.0147935.e027g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e027" xlink:type="simple"/><mml:math display="inline" id="M27"><mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>t</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup></mml:math></alternatives></inline-formula> for <italic>a</italic> ∈ Ω. The total mixing time <italic>τ</italic>(<italic>ϵ</italic>) can therefore be computed from <italic>P</italic> by iterated matrix multiplication. The principle can be described as follows: We transform the adjacency list representation of Γ into its adjacency matrix representation. The entries <italic>P</italic><sub><italic>i</italic>, <italic>j</italic></sub> of this matrix represent the transition probabilities for going from state <italic>i</italic> to state <italic>j</italic>, so this matrix is the transition matrix described above. Since the total variation distance decreases monotonically with <italic>t</italic>, we can find <italic>τ</italic>(<italic>ϵ</italic>) with a two-step procedure.</p>
<list list-type="order">
<list-item>
<p>Starting with <italic>i</italic> = 0, we iteratively increment <italic>i</italic> until <inline-formula id="pone.0147935.e028"><alternatives><graphic id="pone.0147935.e028g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e028" xlink:type="simple"/><mml:math display="inline" id="M28"><mml:mrow><mml:msub><mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mrow><mml:mi>a</mml:mi> <mml:mo>∈</mml:mo> <mml:mi>Ω</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:msup><mml:mn>2</mml:mn> <mml:mi>i</mml:mi></mml:msup> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>-</mml:mo> <mml:mi>π</mml:mi> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:mo>≤</mml:mo> <mml:mi>ϵ</mml:mi></mml:mrow></mml:math></alternatives></inline-formula>. This requires, in fact, just a sequence of <italic>i</italic> = ⌈log<sub>2</sub>(<italic>τ</italic>(<italic>ϵ</italic>))⌉ matrix squaring operations to compute the matrices <italic>P</italic><sup>2</sup>, <italic>P</italic><sup>4</sup>, <italic>P</italic><sup>8</sup>, …, <italic>P</italic><sup>2<sup><italic>i</italic></sup></sup>. At the end of step one, we know that the total mixing time <italic>τ</italic>(<italic>ϵ</italic>) lies in the range 2<sup><italic>i</italic>−1</sup> &lt; <italic>τ</italic>(<italic>ϵ</italic>) ≤ 2<sup><italic>i</italic></sup>.</p>
</list-item>
<list-item>
<p>We use binary search to find <italic>τ</italic>(<italic>ϵ</italic>). We define two variables <italic>l</italic> = 2<sup><italic>i</italic>−1</sup> and <italic>r</italic> = 2<sup><italic>i</italic></sup> representing respectively lower and upper bounds on <italic>τ</italic>(<italic>ϵ</italic>). In a sequence of log<sub>2</sub>(<italic>r</italic> − <italic>l</italic>) = ⌈log<sub>2</sub>(<italic>τ</italic>(<italic>ϵ</italic>))⌉ − 1 iterations, we half the search space in each step by computing the total variation distance <inline-formula id="pone.0147935.e029"><alternatives><graphic id="pone.0147935.e029g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e029" xlink:type="simple"/><mml:math display="inline" id="M29"><mml:mrow><mml:msub><mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mrow><mml:mi>a</mml:mi> <mml:mo>∈</mml:mo> <mml:mi>Ω</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>m</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>-</mml:mo> <mml:mi>π</mml:mi> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> with <italic>m</italic> = ⌊(<italic>l</italic> + <italic>r</italic>)/2⌋ from <italic>P</italic><sup><italic>m</italic></sup>. Although <italic>P</italic><sup><italic>m</italic></sup> could, in principle, be computed from <italic>P</italic> with binary exponentiation, we save additional matrix multiplications by reusing <italic>P</italic><sup><italic>l</italic></sup> to compute <italic>P</italic><sup><italic>m</italic></sup> = <italic>P</italic><sup><italic>l</italic></sup> <italic>P</italic><sup><italic>m</italic>−<italic>l</italic></sup>. Maintaining the invariant <inline-formula id="pone.0147935.e030"><alternatives><graphic id="pone.0147935.e030g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e030" xlink:type="simple"/><mml:math display="inline" id="M30"><mml:mrow><mml:msub><mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mrow><mml:mi>a</mml:mi> <mml:mo>∈</mml:mo> <mml:mi>Ω</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>l</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>-</mml:mo> <mml:mrow><mml:mi>π</mml:mi> <mml:mo>|</mml:mo> <mml:mo>|</mml:mo> <mml:mo>&gt;</mml:mo> <mml:mi>ϵ</mml:mi></mml:mrow> <mml:mo>≥</mml:mo> <mml:msub><mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mrow><mml:mi>a</mml:mi> <mml:mo>∈</mml:mo> <mml:mi>Ω</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msubsup><mml:mi>p</mml:mi> <mml:mi>a</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>r</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:msubsup> <mml:mo>-</mml:mo> <mml:mi>π</mml:mi> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>|</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula>, we update the lower bound <italic>l</italic> or the upper bound <italic>r</italic>, depending, whether the total variation distance is larger than <italic>ϵ</italic> or not. We stop when <italic>l</italic> ≥ <italic>r</italic>. The value of <italic>r</italic> is the total mixing time.</p>
</list-item>
</list>
<p specific-use="continuation">Computing the total mixing time requires <italic>O</italic>(|Ω|<sup>2</sup>) memory and <italic>O</italic>(log(<italic>τ</italic>(<italic>ϵ</italic>)) ⋅ |Ω|<sup><italic>ω</italic></sup>) time, where <italic>ω</italic> is the exponent of the matrix multiplication algorithm. (In most libraries, <italic>ω</italic> is equal to 3. However, the matrix multiplication implementation can be exchanged by using another implementation when building the library.)</p>
<p>Computing the total mixing time is currently by far the most time and memory consuming operation in our library. Due to quadratic memory requirement, it is applicable only for small state graphs with |Ω| ≤ 30000 (depending on main memory). Since this method is also very time-consuming, we provide three implementations, which can be used if the appropriate hardware is available:</p>
<list list-type="order">
<list-item>
<p>A classical CPU implementation on the basis of <italic>openBLAS</italic>[<xref ref-type="bibr" rid="pone.0147935.ref011">11</xref>], which runs in parallel on multi-core CPUs. This method should be used for very small instances, or if no <italic>CUDA</italic>-capable GPU is available.</p>
</list-item>
<list-item>
<p>A <italic>cuBLAS</italic>[<xref ref-type="bibr" rid="pone.0147935.ref012">12</xref>] based GPU implementation which can be significantly faster than the CPU implementation. Because of the lack of memory on most GPUs, this implementation is designed for small state graphs with |Ω| ≤ 15000 (depending on GPU memory).</p>
</list-item>
<list-item>
<p>A CPU-GPU hybrid implementation using the <italic>cuBLASXt</italic>[<xref ref-type="bibr" rid="pone.0147935.ref013">13</xref>] library for matrix multiplication. This implementation should be the method of choice if a <italic>CUDA</italic> capable GPU is available. This method is typically faster than the CPU implementation and has the additional advantage that the CPU is free to be used for other computations.</p>
</list-item>
</list>
<p specific-use="continuation">The three implementations share the same asymptotical running time, but differ greatly in practice (see <xref ref-type="fig" rid="pone.0147935.g001">Fig 1</xref> for a comparison of performance). Since most of the work is matrix multiplication, this comparison almost directly maps to a performance comparison between the corresponding libraries for matrix multiplication. The <italic>O</italic>(log(<italic>τ</italic>(<italic>ϵ</italic>))) invocations of the total variation distance computation, each with time complexity of <italic>O</italic>(|Ω|<sup>2</sup>), contribute only a little to the running time.</p>
<fig id="pone.0147935.g001" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g001</object-id>
<label>Fig 1</label>
<caption>
<title>Single and double precision performance of the total mixing time computation.</title>
<p>The charts show the running time for the computation of the total mixing time on the example of five state graphs of size 8012 to 20358. Due to the relatively small amount of GPU memory on our test system, only the first four (respectively two) state graphs could be processed by the GPU implementation in single precision mode (respectively double precision mode). The running times were measured on an Ubuntu 14.04 system with a Intel Xeon E3-1231, NVIDIA GeForce GTX 970 (4 GB GPU memory) and 16 GB of main memory, using <italic>gcc</italic> in version 4.8.4 and <italic>CUDA</italic> in version 7.0.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g001" xlink:type="simple"/>
</fig>
</sec>
<sec id="sec013">
<title>Computation of the Spectral Bound</title>
<p>The difference between the largest and the second largest eigenvalue (1 − <italic>λ</italic><sub>max</sub>) of a Markov chain’s transition matrix is known as the <italic>spectral gap</italic> and is of central interest in mixing time analysis. To compute this quantity, we use the well-known <italic>ARPACK++</italic>[<xref ref-type="bibr" rid="pone.0147935.ref014">14</xref>] library to compute the two real eigenvalues with the largest magnitude of the transition matrix <italic>P</italic>. In case of non-symmetric transition rules, we first transform the transition matrix <italic>P</italic> into the symmetrical matrix <italic>P</italic><sub><italic>sym</italic></sub> via <xref ref-type="disp-formula" rid="pone.0147935.e012">Eq (5)</xref>. After computing both eigenvalues with the largest magnitude, we use the second eigenvalue in order to compute the upper and lower spectral bound via Inequalities Eqs <xref ref-type="disp-formula" rid="pone.0147935.e010">(3)</xref> and <xref ref-type="disp-formula" rid="pone.0147935.e011">(4)</xref>. Since this method requires only a sparse representation of the transition matrix, it is also applicable for large state graphs.</p>
</sec>
<sec id="sec014">
<title>Computing the Congestion Bound</title>
<p>As stated in the introduction, we are also interested in the quality of other bounding techniques. In particular, we are interested in the canonical path method which is often used to gain theoretical bounds. We implemented a method that can be used to gain an upper bound on the mixing time by computing the maximal congestion of a user-definable path construction scheme. Four each pair of states (<italic>u</italic>, <italic>v</italic>) ∈ Ω × Ω we apply the path construction scheme to construct a path <italic>p</italic> from state <italic>u</italic> to state <italic>v</italic>. The congestion of each transition arc lying on this path is increased by |<italic>p</italic>|<italic>π</italic>(<italic>u</italic>)<italic>π</italic>(<italic>v</italic>) (see <xref ref-type="disp-formula" rid="pone.0147935.e016">Eq (6)</xref>). Since the construction of |Ω|<sup>2</sup> paths can be done completely independently of each other, we use <italic>OpenMP</italic> to construct all paths in parallel. The maximal congestion of any transition arc is used for computing the upper bound via Inequality <xref ref-type="disp-formula" rid="pone.0147935.e018">Eq (7)</xref>. This method has a time complexity of <italic>O</italic>(|Ω|<sup>2</sup>) and a memory complexity of <italic>O</italic>(|Ψ|).</p>
</sec>
<sec id="sec015">
<title>Network Analysis</title>
<p>As state graphs can be seen as weighted directed graphs, all kinds of graph algorithms can be integrated into <italic>marathon</italic>. As an example, we added functions for computing the diameter of a state graph, as well as functions for computing the average path length.</p>
</sec>
</sec>
<sec id="sec016">
<title>Exemplary Markov-Chains</title>
<p>To demonstrate possible applications of <italic>marathon</italic>, we will describe a set of experiments in the following section. In our experiments, we focus on two famous sampling problems. The problem of uniformly sampling a <italic>perfect matching</italic> in a <italic>bipartite graph</italic> and of uniformly sampling a <italic>bipartite graph realization</italic> for given <italic>vertex degrees</italic>. Both problems are based on bipartite graphs. A <italic>bipartite graph</italic> <italic>G</italic> = (<italic>U</italic>, <italic>V</italic>, <italic>E</italic>) is an undirected graph with disjoint vertex sets <italic>V</italic> and <italic>U</italic> and a set of edges <italic>E</italic> ⊆ <italic>U</italic> × <italic>V</italic>, connecting vertices from <italic>U</italic> with <italic>V</italic>. We will refer to the vertices of <italic>U</italic> as <italic>u</italic><sub><italic>i</italic></sub>, where <italic>i</italic> ranges from 1 to <italic>n</italic> := |<italic>U</italic>| and to the vertices of <italic>V</italic> as <italic>v</italic><sub><italic>j</italic></sub>, where <italic>j</italic> ranges from 1 to <italic>n</italic>′: = |<italic>V</italic>|. We analysed four different chains that can be used for these sampling problems. To make this article self-contained, we give a introduction to the chains.</p>
</sec>
<sec id="sec017">
<title>Markov Chains for Sampling of Perfect Matchings</title>
<p>A <italic>perfect matching</italic> in a bipartite graph <italic>G</italic> = (<italic>U</italic>, <italic>V</italic>, <italic>E</italic>), with <italic>n</italic> = <italic>n</italic>′, is a subset <italic>M</italic> ⊆ <italic>E</italic> of edges such that a) all edges in <italic>M</italic> are non-adjacent, and b) |<italic>M</italic>| = <italic>n</italic>. Uniformly sampling a perfect matching is the problem of choosing one perfect matching from the set of all perfect matchings of <italic>G</italic> uniformly at random. We describe two important Markov chains which are known to solve the problem of uniformly sampling perfect matchings. These chains origin from applications in statistical physics and are widely known in the field of Markov chain analysis, so they make good examples for our analysis. Both Markov chains use the set of near-perfect matchings as auxiliary states. A <italic>near-perfect matching</italic> is a subset of non-adjacent edges from <italic>E</italic>, but with one edge less than a perfect matching. So, being specific, the Markov chains used for sampling are based on the set Ω<sub><italic>M</italic></sub> of perfect and near perfect matchings in <italic>G</italic>.</p>
<sec id="sec018">
<title>Matching Chain One</title>
<p>Broder [<xref ref-type="bibr" rid="pone.0147935.ref015">15</xref>] introduced a Markov chain which can be described as follows. In state <italic>M</italic> ∈ Ω<sub><italic>M</italic></sub> we pick a candidate state <italic>M</italic>′ (line three in Algorithm 1) by choosing an edge <italic>e</italic> = {<italic>u</italic>, <italic>v</italic>} from <italic>E</italic> uniformly at random. One of five cases occurs:</p>
<list list-type="order">
<list-item>
<p>If <italic>M</italic> is a perfect matching and <italic>e</italic> ∈ <italic>M</italic>, then remove <italic>e</italic> from <italic>M</italic> and select <italic>M</italic>′ ← <italic>M</italic>\{<italic>e</italic>}.</p>
</list-item>
<list-item>
<p>If <italic>M</italic> is a near-perfect matching and <italic>e</italic> ∉ <italic>M</italic>, then add <italic>e</italic> to <italic>M</italic> and select <italic>M</italic>′ ← <italic>M</italic> ∪ {<italic>e</italic>}.</p>
</list-item>
<list-item>
<p>If <italic>M</italic> is a near-perfect matching, <italic>u</italic> is not matched in <italic>M</italic>, and an edge <italic>e</italic>′ = {<italic>w</italic>, <italic>v</italic>} ∈ <italic>M</italic> exists, then remove <italic>e</italic>′ from <italic>M</italic>, add <italic>e</italic> and select <italic>M</italic>′ ← (<italic>M</italic> \ {<italic>e</italic>′}) ∪ {<italic>e</italic>}.</p>
</list-item>
<list-item>
<p>Symmetrically, if <italic>M</italic> is a near-perfect matching, <italic>v</italic> is not matched in <italic>M</italic>, and an edge <italic>e</italic>′ = {<italic>u</italic>, <italic>z</italic>} ∈ <italic>M</italic> exists, then remove <italic>e</italic>′ from <italic>M</italic>, add <italic>e</italic> and select <italic>M</italic>′ ← (<italic>M</italic> \ {<italic>e</italic>′}) ∪ {<italic>e</italic>}.</p>
</list-item>
<list-item>
<p>In all other cases, stay at <italic>M</italic>.</p>
</list-item>
</list>
<p specific-use="continuation">The state <italic>M</italic>′ is proposed as a candidate state with proposal probability <italic>κ</italic>(<italic>M</italic>, <italic>M</italic>′) = 1/|<italic>E</italic>| in line three of Algorithm 1. The proposed state <italic>M</italic>′ is accepted or refused by line four of Algorithm 1, using unit weights. So, this chain converges to a uniform stationary distribution. In the remainder of this article, we refer to this Markov chain as <italic>Matching Chain One</italic>. Jerrum and Sinclair [<xref ref-type="bibr" rid="pone.0147935.ref016">16</xref>] proved that Matching Chain One is rapidly mixing for a graph class where the ratio of near-perfect matchings <inline-formula id="pone.0147935.e031"><alternatives><graphic id="pone.0147935.e031g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e031" xlink:type="simple"/><mml:math display="inline" id="M31"><mml:mrow><mml:mi mathvariant="script">N</mml:mi> <mml:mo>(</mml:mo> <mml:mi>G</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:math></alternatives></inline-formula> and perfect matchings <inline-formula id="pone.0147935.e032"><alternatives><graphic id="pone.0147935.e032g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e032" xlink:type="simple"/><mml:math display="inline" id="M32"><mml:mrow><mml:mi mathvariant="script">M</mml:mi> <mml:mo>(</mml:mo> <mml:mi>G</mml:mi> <mml:mo>)</mml:mo></mml:mrow></mml:math></alternatives></inline-formula> in <italic>G</italic> is polynomially bounded. Being specific, its total mixing time can be bounded from above:
<disp-formula id="pone.0147935.e033"><alternatives><graphic id="pone.0147935.e033g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e033" xlink:type="simple"/><mml:math display="block" id="M33"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>≤</mml:mo> <mml:msup><mml:mn>16</mml:mn> <mml:mn>2</mml:mn></mml:msup> <mml:msup><mml:mrow><mml:mo>|</mml:mo> <mml:mi>E</mml:mi> <mml:mo>|</mml:mo></mml:mrow> <mml:mn>2</mml:mn></mml:msup> <mml:msup><mml:mfenced close=")" open="(" separators=""><mml:mfrac><mml:mrow><mml:mo>|</mml:mo> <mml:mi mathvariant="script">N</mml:mi> <mml:mo>(</mml:mo> <mml:mi>G</mml:mi> <mml:mo>)</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:mrow><mml:mo>|</mml:mo> <mml:mi mathvariant="script">M</mml:mi> <mml:mo>(</mml:mo> <mml:mi>G</mml:mi> <mml:mo>)</mml:mo> <mml:mo>|</mml:mo></mml:mrow></mml:mfrac></mml:mfenced> <mml:mn>4</mml:mn></mml:msup> <mml:mrow><mml:mo form="prefix">ln</mml:mo> <mml:mo>(</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msub><mml:mo>Ω</mml:mo> <mml:mi>M</mml:mi></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>·</mml:mo> <mml:msup><mml:mi>ϵ</mml:mi> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(9)</label></disp-formula>
The class of <italic>dense</italic> bipartite graphs, i.e. bipartite graphs <italic>G</italic> = (<italic>U</italic>, <italic>W</italic>, <italic>E</italic>) with |<italic>U</italic>| = |<italic>W</italic>| = <italic>n</italic> and with minimal vertex degree of at least <italic>n</italic>/2, was shown as a class for which the ratio of near-perfect and perfect matchings is polynomially bounded [<xref ref-type="bibr" rid="pone.0147935.ref016">16</xref>]. For this class of graphs, the following upper bound on the total mixing time can be gained [<xref ref-type="bibr" rid="pone.0147935.ref017">17</xref>]:
<disp-formula id="pone.0147935.e034"><alternatives><graphic id="pone.0147935.e034g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e034" xlink:type="simple"/><mml:math display="block" id="M34"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mrow><mml:mi>τ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>∈</mml:mo> <mml:mi>O</mml:mi> <mml:mo>(</mml:mo></mml:mrow> <mml:msup><mml:mi>n</mml:mi> <mml:mn>7</mml:mn></mml:msup> <mml:mrow><mml:mo form="prefix">ln</mml:mo> <mml:mo>(</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msub><mml:mo>Ω</mml:mo> <mml:mi>M</mml:mi></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>·</mml:mo></mml:mrow> <mml:msup><mml:mi>ϵ</mml:mi> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mrow><mml:mo>)</mml:mo> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(10)</label></disp-formula>
A main problem of Matching Chain One is the fact that it does not only generate perfect matchings but also <italic>near-perfect</italic> matchings. In many graphs with 2<italic>n</italic> vertices the ratio of the number of near-perfect and perfect matchings cannot be bounded by a polynomial which is dependent on <italic>n</italic>. In such cases, the sampling of a perfect matching needs an exponential number of trials to see a perfect matching at all.</p>
</sec>
<sec id="sec019">
<title>Matching Chain Two</title>
<p>One way to overcome the problem of an exponential total mixing time has been given by Jerrum, Sinclair and Vigoda [<xref ref-type="bibr" rid="pone.0147935.ref018">18</xref>]. Their main idea is to use a carefully chosen weight function <italic>w</italic> to sample from a non-uniform distribution. This way, they gained a rapidly mixing Markov chain which can be used to sample perfect matchings from any given bipartite graph. In addition, the transition rules were changed to the following: In a state <italic>M</italic> ∈ Ω<sub><italic>M</italic></sub>:</p>
<list list-type="order">
<list-item>
<p>If <italic>M</italic> is a perfect matching, we choose an edge <italic>e</italic> = {<italic>u</italic>, <italic>v</italic>} from <italic>M</italic> uniformly at random. Remove <italic>e</italic> from <italic>M</italic> and select <italic>M</italic>′ ← <italic>M</italic>\{<italic>e</italic>}.</p>
</list-item>
<list-item>
<p>If <italic>M</italic> is a near-perfect matching where <italic>u</italic> and <italic>v</italic> are unmatched vertices, we choose a vertex <italic>z</italic> ∈ <italic>U</italic> ∪ <italic>V</italic> uniformly at random.
<list list-type="alpha-lower">
<list-item>
<p>If <italic>z</italic> is one of the unmatched vertices <italic>u</italic> and <italic>v</italic> and <italic>e</italic> = {<italic>u</italic>, <italic>v</italic>} ∈ <italic>E</italic>, then add <italic>e</italic> to <italic>M</italic> and select <italic>M</italic>′ ← <italic>M</italic> ∪ {<italic>e</italic>}.</p>
</list-item>
<list-item>
<p>If <italic>z</italic> ∈ <italic>V</italic>, {<italic>u</italic>, <italic>z</italic>} ∈ <italic>E</italic> and {<italic>x</italic>, <italic>z</italic>} ∈ <italic>M</italic>, then remove the edge {<italic>x</italic>, <italic>z</italic>} from <italic>M</italic>, add {<italic>u</italic>, <italic>z</italic>} and select <italic>M</italic>′ ← (<italic>M</italic>\{{<italic>x</italic>, <italic>z</italic>}}) ∪ {{<italic>u</italic>, <italic>z</italic>}}.</p>
</list-item>
<list-item>
<p>If <italic>z</italic> ∈ <italic>U</italic>, {<italic>z</italic>, <italic>v</italic>} ∈ <italic>E</italic> and {<italic>z</italic>, <italic>y</italic>} ∈ <italic>M</italic>, then remove the edge {<italic>z</italic>, <italic>y</italic>} from <italic>M</italic>, add {<italic>z</italic>, <italic>v</italic>} and select <italic>M</italic>′ ← (<italic>M</italic> \ {{<italic>z</italic>, <italic>y</italic>}}) ∪ {{<italic>z</italic>, <italic>v</italic>}}.</p>
</list-item>
</list>
</p></list-item>
</list>
<p specific-use="continuation">The proposal probability <italic>κ</italic>(<italic>M</italic>,<italic>M</italic>′) for two states <italic>M</italic>,<italic>M</italic>′ ∈ Ω<sub><italic>M</italic></sub> is therefore 1/<italic>n</italic> when moving between perfect and near-perfect matchings and 1/(2<italic>n</italic>) when moving between near-perfect matchings. In connection with Algorithm 1, this Markov chain converges to a stationary distribution <italic>π</italic> which is proportional to the weight function <italic>w</italic>. Defining <inline-formula id="pone.0147935.e035"><alternatives><graphic id="pone.0147935.e035g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e035" xlink:type="simple"/><mml:math display="inline" id="M35"><mml:mi mathvariant="script">M</mml:mi></mml:math></alternatives></inline-formula> as the set of perfect matchings of <italic>G</italic>, and <inline-formula id="pone.0147935.e036"><alternatives><graphic id="pone.0147935.e036g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e036" xlink:type="simple"/><mml:math display="inline" id="M36"><mml:msub><mml:mi mathvariant="script">N</mml:mi> <mml:mrow><mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:math></alternatives></inline-formula> as the set of near perfect matchings in <italic>G</italic> where <italic>u</italic> and <italic>v</italic> are unmatched, the weight function suggested in [<xref ref-type="bibr" rid="pone.0147935.ref018">18</xref>] is defined as:
<disp-formula id="pone.0147935.e037"><alternatives><graphic id="pone.0147935.e037g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e037" xlink:type="simple"/><mml:math display="block" id="M37"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>w</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>M</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>=</mml:mo> <mml:mfenced close="" open="{" separators=""><mml:mtable><mml:mtr><mml:mtd columnalign="left"><mml:mrow><mml:mn>1</mml:mn> <mml:mo>,</mml:mo></mml:mrow></mml:mtd> <mml:mtd columnalign="left"><mml:mrow><mml:mi>M</mml:mi> <mml:mo>∈</mml:mo> <mml:mi mathvariant="script">M</mml:mi></mml:mrow></mml:mtd></mml:mtr> <mml:mtr><mml:mtd columnalign="left"><mml:mrow><mml:mrow><mml:mo>|</mml:mo> <mml:mi mathvariant="script">M</mml:mi> <mml:mo>|</mml:mo> <mml:mo>/</mml:mo> <mml:mo>|</mml:mo></mml:mrow> <mml:msub><mml:mi mathvariant="script">N</mml:mi> <mml:mrow><mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo> <mml:mo>,</mml:mo></mml:mrow></mml:mrow></mml:mtd> <mml:mtd columnalign="left"><mml:mrow><mml:mi>M</mml:mi> <mml:mo>∈</mml:mo> <mml:msub><mml:mi mathvariant="script">N</mml:mi> <mml:mrow><mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi></mml:mrow></mml:msub> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(11)</label></disp-formula>
Knowing the values of <inline-formula id="pone.0147935.e038"><alternatives><graphic id="pone.0147935.e038g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e038" xlink:type="simple"/><mml:math display="inline" id="M38"><mml:mrow><mml:mo>|</mml:mo> <mml:mi mathvariant="script">M</mml:mi> <mml:mo>|</mml:mo></mml:mrow></mml:math></alternatives></inline-formula> and <inline-formula id="pone.0147935.e039"><alternatives><graphic id="pone.0147935.e039g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e039" xlink:type="simple"/><mml:math display="inline" id="M39"><mml:mrow><mml:mrow><mml:mo>|</mml:mo></mml:mrow> <mml:msub><mml:mi mathvariant="script">N</mml:mi> <mml:mrow><mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula>, the total mixing time of this chain can be bounded from above by the following polynomial [<xref ref-type="bibr" rid="pone.0147935.ref019">19</xref>]:
<disp-formula id="pone.0147935.e040"><alternatives><graphic id="pone.0147935.e040g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e040" xlink:type="simple"/><mml:math display="block" id="M40"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>∈</mml:mo> <mml:mi>O</mml:mi> <mml:mo>(</mml:mo> <mml:msup><mml:mi>n</mml:mi> <mml:mn>4</mml:mn></mml:msup> <mml:mo form="prefix">ln</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:msup><mml:mrow><mml:mo>(</mml:mo> <mml:msub><mml:mi>π</mml:mi> <mml:mrow><mml:mi>m</mml:mi> <mml:mi>i</mml:mi> <mml:mi>n</mml:mi></mml:mrow></mml:msub> <mml:mo>·</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(12)</label></disp-formula>
Unfortunately, <inline-formula id="pone.0147935.e041"><alternatives><graphic id="pone.0147935.e041g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e041" xlink:type="simple"/><mml:math display="inline" id="M41"><mml:mrow><mml:mo>|</mml:mo> <mml:mi mathvariant="script">M</mml:mi> <mml:mo>|</mml:mo></mml:mrow></mml:math></alternatives></inline-formula> and <inline-formula id="pone.0147935.e042"><alternatives><graphic id="pone.0147935.e042g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e042" xlink:type="simple"/><mml:math display="inline" id="M42"><mml:mrow><mml:mrow><mml:mo>|</mml:mo></mml:mrow> <mml:msub><mml:mi mathvariant="script">N</mml:mi> <mml:mrow><mml:mi>u</mml:mi> <mml:mo>,</mml:mo> <mml:mi>v</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mo>|</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> are usually not known in practice. Jerrum, Sinclair and Vigoda gave a description of a procedure for approximating these quantities in polynomial time [<xref ref-type="bibr" rid="pone.0147935.ref018">18</xref>]. In our experiments though, we knew the exact values since we had a list of all states. In combination with Algorithm 1, this Markov chain is rapidly mixing for all bipartite graphs and can be used for sampling of perfect matchings. We refer to this chain as <italic>Matching Chain Two</italic>.</p>
</sec>
</sec>
<sec id="sec020">
<title>Markov Chains for Sampling of Bipartite Graph Realizations</title>
<p>The <italic>bipartite graph realization problem</italic> is to find, for a pair of non-increasing integer sequences (<italic>a</italic><sub>1</sub>, …, <italic>a</italic><sub><italic>n</italic></sub>), (<italic>b</italic><sub>1</sub>, …, <italic>b</italic><sub><italic>n</italic>′</sub>) with <italic>a</italic><sub><italic>i</italic></sub>, <italic>b</italic><sub><italic>i</italic></sub> &gt; 0, a bipartite graph <italic>G</italic> = (<italic>U</italic>, <italic>V</italic>, <italic>E</italic>), without loops and parallel edges, such that the vertex degrees of <italic>u</italic><sub><italic>i</italic></sub> ∈ <italic>U</italic> matches the <italic>a</italic><sub><italic>i</italic></sub> and that the vertex degrees of <italic>v</italic><sub><italic>i</italic></sub> ∈ <italic>V</italic> match the <italic>b</italic><sub><italic>i</italic></sub>. Such a graph <italic>G</italic> is then called <italic>bipartite graph realization</italic> or, shorter still, <italic>realization</italic>. The set of all realizations of a given degree sequence pair makes the sampling set Ω<sub><italic>R</italic></sub> for this sampling problem. The bipartite graph realization problem is so important in many fields that it was reinvented several times. It is also known as the problem of <italic>contingency tables with given marginal sums</italic> or, as <italic>matrices with fixed row and column sums</italic>. As a direct application of random bipartite graphs, scientists often use a sampled realization as a null model to prove statistical hypotheses. Since sampling of random bipartite graphs is important in a wide range of fields, we chose it as a second example for our experiments.</p>
<p>In contemporary literature, one can find two possible Markov chains that solve the problem of uniform sampling of a bipartite graph realization. One of these approaches is simply to transform it into the perfect matching sampling problem [<xref ref-type="bibr" rid="pone.0147935.ref020">20</xref>]. This way, it is known that the running time of the sampling procedure is bounded polynomially. However, the very simple and intuitive <italic>switch chain</italic>, presented by Kannan et al. [<xref ref-type="bibr" rid="pone.0147935.ref021">21</xref>], is widely used in practice.</p>
<sec id="sec021">
<title>Switch Chain One</title>
<p>At a state <italic>G</italic> = (<italic>U</italic>, <italic>V</italic>, <italic>E</italic>) ∈ Ω<sub><italic>R</italic></sub>, choose four integers <italic>i</italic>, <italic>j</italic>, <italic>k</italic>, <italic>l</italic> with 1 ≤ <italic>i</italic> ≤ <italic>k</italic> ≤ <italic>n</italic> and 1 ≤ <italic>j</italic> ≤ <italic>l</italic> ≤ <italic>n</italic>′ uniformly at random. One of three cases occur:</p>
<list list-type="order">
<list-item>
<p>If the edges <italic>e</italic><sub>1</sub> = {<italic>u</italic><sub><italic>i</italic></sub>, <italic>v</italic><sub><italic>j</italic></sub>} and <italic>e</italic><sub>2</sub> = {<italic>u</italic><sub><italic>k</italic></sub>, <italic>v</italic><sub><italic>l</italic></sub>} exist in <italic>E</italic> but the edges <inline-formula id="pone.0147935.e043"><alternatives><graphic id="pone.0147935.e043g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e043" xlink:type="simple"/><mml:math display="inline" id="M43"><mml:mrow><mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>=</mml:mo> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>u</mml:mi> <mml:mi>i</mml:mi></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>v</mml:mi> <mml:mi>l</mml:mi></mml:msub> <mml:mo>}</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> and <inline-formula id="pone.0147935.e044"><alternatives><graphic id="pone.0147935.e044g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e044" xlink:type="simple"/><mml:math display="inline" id="M44"><mml:mrow><mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>=</mml:mo> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>u</mml:mi> <mml:mi>k</mml:mi></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>v</mml:mi> <mml:mi>j</mml:mi></mml:msub> <mml:mo>}</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> do not, then select <italic>G</italic>′ = (<italic>V</italic>, <italic>U</italic>, <italic>E</italic>′) with <inline-formula id="pone.0147935.e045"><alternatives><graphic id="pone.0147935.e045g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e045" xlink:type="simple"/><mml:math display="inline" id="M45"><mml:mrow><mml:msup><mml:mi>E</mml:mi> <mml:mo>′</mml:mo></mml:msup> <mml:mo>←</mml:mo> <mml:mo>(</mml:mo> <mml:mi>E</mml:mi> <mml:mo>∖</mml:mo> <mml:mo>{</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>1</mml:mn></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>2</mml:mn></mml:msub> <mml:mo>}</mml:mo> <mml:mo>)</mml:mo> <mml:mo>∪</mml:mo> <mml:mo>{</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>,</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>}</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>.</p>
</list-item>
<list-item>
<p>Symmetrically, if <italic>e</italic><sub>1</sub> = {<italic>u</italic><sub><italic>i</italic></sub>, <italic>v</italic><sub><italic>j</italic></sub>} and <italic>e</italic><sub>2</sub> = {<italic>u</italic><sub><italic>k</italic></sub>, <italic>v</italic><sub><italic>l</italic></sub>} both do not exist in <italic>E</italic> but the edges <inline-formula id="pone.0147935.e046"><alternatives><graphic id="pone.0147935.e046g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e046" xlink:type="simple"/><mml:math display="inline" id="M46"><mml:mrow><mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>=</mml:mo> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>u</mml:mi> <mml:mi>i</mml:mi></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>v</mml:mi> <mml:mi>l</mml:mi></mml:msub> <mml:mo>}</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> and <inline-formula id="pone.0147935.e047"><alternatives><graphic id="pone.0147935.e047g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e047" xlink:type="simple"/><mml:math display="inline" id="M47"><mml:mrow><mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>=</mml:mo> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>u</mml:mi> <mml:mi>k</mml:mi></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>v</mml:mi> <mml:mi>j</mml:mi></mml:msub> <mml:mo>}</mml:mo></mml:mrow></mml:mrow></mml:math></alternatives></inline-formula> exist, select <italic>G</italic>′ = (<italic>V</italic>, <italic>U</italic>, <italic>E</italic>′) with <inline-formula id="pone.0147935.e048"><alternatives><graphic id="pone.0147935.e048g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e048" xlink:type="simple"/><mml:math display="inline" id="M48"><mml:mrow><mml:msup><mml:mi>E</mml:mi> <mml:mo>′</mml:mo></mml:msup> <mml:mo>←</mml:mo> <mml:mo>(</mml:mo> <mml:mi>E</mml:mi> <mml:mo>∖</mml:mo> <mml:mo>{</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>,</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>}</mml:mo> <mml:mo>)</mml:mo> <mml:mo>∪</mml:mo> <mml:mo>{</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>1</mml:mn></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>2</mml:mn></mml:msub> <mml:mo>}</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>.</p>
</list-item>
<list-item>
<p>In all other cases, select <italic>G</italic>′ ← <italic>G</italic>.</p>
</list-item>
</list>
<p specific-use="continuation">Such a <italic>switch</italic>, i.e. changing the endpoints of two edges, does not change the degree sequence and thus constructs a new bipartite graph realization of <italic>S</italic>. It turns out, all graph realizations can be generated by starting with a given graph realization and applying a number of switches [<xref ref-type="bibr" rid="pone.0147935.ref022">22</xref>]. The proposal probability <italic>κ</italic>(<italic>G</italic>,<italic>G</italic>′) of a non-loop transition is <inline-formula id="pone.0147935.e049"><alternatives><graphic id="pone.0147935.e049g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e049" xlink:type="simple"/><mml:math display="inline" id="M49"><mml:mrow><mml:mfrac><mml:mn>2</mml:mn> <mml:mrow><mml:mi>n</mml:mi> <mml:mo>(</mml:mo> <mml:mi>n</mml:mi> <mml:mo>+</mml:mo> <mml:mn>1</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:mfrac> <mml:mo>·</mml:mo> <mml:mfrac><mml:mn>2</mml:mn> <mml:mrow><mml:msup><mml:mi>n</mml:mi> <mml:mo>′</mml:mo></mml:msup> <mml:mrow><mml:mo>(</mml:mo> <mml:msup><mml:mi>n</mml:mi> <mml:mo>′</mml:mo></mml:msup> <mml:mo>+</mml:mo> <mml:mn>1</mml:mn> <mml:mo>)</mml:mo></mml:mrow></mml:mrow></mml:mfrac></mml:mrow></mml:math></alternatives></inline-formula>. Using unit weights <italic>w</italic>(<italic>x</italic>) = 1 for all <italic>x</italic> ∈ Ω<sub><italic>R</italic></sub> Algorithm 1 converges to a uniform stationary distribution. Kannan et al. [<xref ref-type="bibr" rid="pone.0147935.ref021">21</xref>] proved polynomially bounded mixing times of this chain for regular sequence pairs. Miklós et al. [<xref ref-type="bibr" rid="pone.0147935.ref023">23</xref>] extended the proof to half-regular sequence pairs. For all other sequence classes, the problem of the rapid mixing property is still open. We will refer to this Markov chain as <italic>Switch Chain One</italic>. Recently, Greenhill gave a proof that the total mixing time of the directed, non-bipartite version of Switch Chain One is bounded by the following polynomial when the largest degree <italic>d</italic><sub>max</sub> of the input sequence lies in the range <inline-formula id="pone.0147935.e050"><alternatives><graphic id="pone.0147935.e050g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e050" xlink:type="simple"/><mml:math display="inline" id="M50"><mml:mrow><mml:mn>3</mml:mn> <mml:mo>≤</mml:mo> <mml:msub><mml:mi>d</mml:mi> <mml:mo form="prefix" movablelimits="true">max</mml:mo></mml:msub> <mml:mo>≤</mml:mo> <mml:mfrac><mml:mn>1</mml:mn> <mml:mn>4</mml:mn></mml:mfrac> <mml:msqrt><mml:mrow><mml:mo>|</mml:mo> <mml:mi>E</mml:mi> <mml:mo>|</mml:mo></mml:mrow></mml:msqrt></mml:mrow></mml:math></alternatives></inline-formula>, where |<italic>E</italic>| is the number of edges in the realization [<xref ref-type="bibr" rid="pone.0147935.ref024">24</xref>]:
<disp-formula id="pone.0147935.e051"><alternatives><graphic id="pone.0147935.e051g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e051" xlink:type="simple"/><mml:math display="block" id="M51"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:mi>τ</mml:mi> <mml:mrow><mml:mo>(</mml:mo> <mml:mi>ϵ</mml:mi> <mml:mo>)</mml:mo></mml:mrow> <mml:mo>≤</mml:mo> <mml:mfrac><mml:mn>1</mml:mn> <mml:mn>10</mml:mn></mml:mfrac> <mml:msubsup><mml:mi>d</mml:mi> <mml:mo form="prefix" movablelimits="true">max</mml:mo> <mml:mn>14</mml:mn></mml:msubsup> <mml:msup><mml:mrow><mml:mo>|</mml:mo> <mml:mi>E</mml:mi> <mml:mo>|</mml:mo></mml:mrow> <mml:mn>9</mml:mn></mml:msup> <mml:mrow><mml:mo>(</mml:mo> <mml:mo>|</mml:mo> <mml:mi>E</mml:mi> <mml:mo>|</mml:mo> <mml:mo form="prefix">ln</mml:mo> <mml:mo>|</mml:mo> <mml:mi>E</mml:mi> <mml:mo>|</mml:mo></mml:mrow> <mml:mo>+</mml:mo> <mml:mo form="prefix">ln</mml:mo> <mml:mrow><mml:mo>(</mml:mo> <mml:msup><mml:mi>ϵ</mml:mi> <mml:mrow><mml:mo>-</mml:mo> <mml:mn>1</mml:mn></mml:mrow></mml:msup> <mml:mo>)</mml:mo></mml:mrow> <mml:mrow><mml:mo>)</mml:mo> <mml:mo>.</mml:mo></mml:mrow></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(13)</label></disp-formula></p>
</sec>
<sec id="sec022">
<title>Switch Chain Two</title>
<p>A modification of Switch Chain One, given by Berger et al. [<xref ref-type="bibr" rid="pone.0147935.ref025">25</xref>] for directed graph sequences, can also be used for the bipartite version. The main idea is to reduce the number of transition loops in the state graph. To avoid non-convergence, an additional additional artificial edge {<italic>u</italic><sub>0</sub>, <italic>v</italic><sub>0</sub>}, which connects two additional vertices <italic>u</italic><sub>0</sub> and <italic>v</italic><sub>0</sub>, is added to the set of edges. In a state <italic>G</italic> = (<italic>U</italic>, <italic>V</italic>, <italic>E</italic>) ∈ Ω<sub><italic>R</italic></sub> select a pair of non-adjacent edges <italic>e</italic><sub>1</sub> = {<italic>u</italic><sub><italic>i</italic></sub>, <italic>v</italic><sub><italic>j</italic></sub>} and <italic>e</italic><sub>2</sub> = {<italic>u</italic><sub><italic>k</italic></sub>, <italic>v</italic><sub><italic>l</italic></sub>} from the set <italic>E</italic>∪{{<italic>u</italic><sub>0</sub>, <italic>v</italic><sub>0</sub>}}.</p>
<list list-type="order">
<list-item>
<p>If, <italic>e</italic><sub>1</sub> = {<italic>u</italic><sub>0</sub>, <italic>v</italic><sub>0</sub>} or <italic>e</italic><sub>2</sub> = {<italic>u</italic><sub>0</sub>, <italic>v</italic><sub>0</sub>}, select <italic>G</italic>′ ← <italic>G</italic>.</p>
</list-item>
<list-item>
<p>If <inline-formula id="pone.0147935.e052"><alternatives><graphic id="pone.0147935.e052g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e052" xlink:type="simple"/><mml:math display="inline" id="M52"><mml:mrow><mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>=</mml:mo> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>u</mml:mi> <mml:mi>i</mml:mi></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>v</mml:mi> <mml:mi>l</mml:mi></mml:msub> <mml:mo>}</mml:mo></mml:mrow> <mml:mo>∉</mml:mo> <mml:mi>E</mml:mi></mml:mrow></mml:math></alternatives></inline-formula> and <inline-formula id="pone.0147935.e053"><alternatives><graphic id="pone.0147935.e053g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e053" xlink:type="simple"/><mml:math display="inline" id="M53"><mml:mrow><mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>=</mml:mo> <mml:mrow><mml:mo>{</mml:mo> <mml:msub><mml:mi>u</mml:mi> <mml:mi>k</mml:mi></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>v</mml:mi> <mml:mi>j</mml:mi></mml:msub> <mml:mo>}</mml:mo></mml:mrow> <mml:mo>∉</mml:mo> <mml:mi>E</mml:mi></mml:mrow></mml:math></alternatives></inline-formula>, then switch the edges <inline-formula id="pone.0147935.e054"><alternatives><graphic id="pone.0147935.e054g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e054" xlink:type="simple"/><mml:math display="inline" id="M54"><mml:mrow><mml:mo>(</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>1</mml:mn></mml:msub> <mml:mo>,</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>,</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>2</mml:mn></mml:msub> <mml:mo>,</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>)</mml:mo></mml:mrow></mml:math></alternatives></inline-formula> and select <italic>G</italic>′ = (<italic>V</italic>, <italic>U</italic>, <italic>E</italic>′) with <inline-formula id="pone.0147935.e055"><alternatives><graphic id="pone.0147935.e055g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e055" xlink:type="simple"/><mml:math display="inline" id="M55"><mml:mrow><mml:msup><mml:mi>E</mml:mi> <mml:mo>′</mml:mo></mml:msup> <mml:mo>←</mml:mo> <mml:mo>(</mml:mo> <mml:mi>E</mml:mi> <mml:mo>∖</mml:mo> <mml:mo>{</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>1</mml:mn></mml:msub> <mml:mo>,</mml:mo> <mml:msub><mml:mi>e</mml:mi> <mml:mn>2</mml:mn></mml:msub> <mml:mo>}</mml:mo> <mml:mo>)</mml:mo> <mml:mo>∪</mml:mo> <mml:mo>{</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>1</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>,</mml:mo> <mml:msubsup><mml:mi>e</mml:mi> <mml:mn>2</mml:mn> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>}</mml:mo></mml:mrow></mml:math></alternatives></inline-formula>.</p>
</list-item>
<list-item>
<p>In all other cases, select <italic>G</italic>′ ← <italic>G</italic>.</p>
</list-item>
</list>
<p specific-use="continuation">Without the additional edge, a problem would occur if no adjacent edge pairs existed for each graph realization of a sequence; then, the state graph would not possess loops. Similar arguments like those of Ref. [<xref ref-type="bibr" rid="pone.0147935.ref025">25</xref>] show that this chain converges to the uniform distribution. This chain reduces the average probability of transition loops and, as it will turn out, the average total mixing time. However, the asymptotical total mixing time is the same as for Switch Chain One. We will refer to this chain as <italic>Switch Chain Two</italic>.</p>
</sec>
</sec>
</sec>
<sec id="sec023">
<title>Experiments</title>
<p>We demonstrate our library to experimentally analyse the mixing time behaviour of the Markov chains. The goal of our experiments is to quantify the gap between the total mixing time and the various bounding methods. We are asking the question, whether the bounding techniques are tight or if there is a huge gap between total mixing time and its bounds. The latter case would support the thesis that the total mixing time actually is far smaller than known in theory. This would be a welcomed message for any programmer who wants to implement a sampling method and does not want to choose a highly polynomial (or even exponential) number of steps. We want to make some general remarks before beginning to describe our experiments.</p>
<sec id="sec025">
<title>The choice of <italic>ϵ</italic></title>
<p>Recall, that the total mixing time <italic>τ</italic>(<italic>ϵ</italic>), as well as its bounds depends on the value of <italic>ϵ</italic> which defines the distance to the stationary distribution at the end of the random walk. For the purpose of our experiments, we choose <italic>ϵ</italic> = 10<sup>−3</sup>. Furthermore, for other values of <italic>ϵ</italic> we get similar results.</p>
</sec>
<sec id="sec026">
<title>Applying canonical paths</title>
<p>To compute the congestion bounds, we use the path construction schemes from the original proofs and apply them to concrete state graphs. As those path construction schemes were used to gain theoretical bounds without full knowledge of a Markov chain’s structure, applying them to concrete state graphs shows how sharp such bounds could be if full structural information were available. Consequently, the bounds in general cannot be better than the upper bounds that are gained when applying the scheme on an actual state graph. To understand, how sharp the theoretical bounds can be, we analyse the differences to the actual total mixing times. In the case of matching chains, we use the construction scheme presented in [<xref ref-type="bibr" rid="pone.0147935.ref016">16</xref>] which was used to gain the upper bound given in <xref ref-type="disp-formula" rid="pone.0147935.e034">Eq 10</xref>. In case of the switch chains we apply the definition of the canonical paths from [<xref ref-type="bibr" rid="pone.0147935.ref021">21</xref>]. For the definition of the path construction schemes, we refer to the original articles. We tried as close as possible to implement the original canonical path construction rules. However, the definition often relies on an arbitrary order of the vertices, or orderings of cycles. It turned out that changing these orders has an effect on the quality of the congestion bound. However, as the proofs for the upper bounds are valid for all orderings, this is not a problem for our observations.</p>
</sec>
<sec id="sec027">
<title>Hardware Usage</title>
<p>Since we wanted to compute the properties of a large amount of instances, we decided to compute as many properties of a state graph as possible in parallel. As shown before, the computation of the total mixing time is the bottleneck for our computations. For this reason, we decided to transfer this task to the GPU whenever possible. This has the advantage, that the free CPU cores can be used for the computation of other quantities, while the GPU is occupied. With this strategy, we achieve a large throughput of instances. <xref ref-type="fig" rid="pone.0147935.g002">Fig 2</xref> shows the hardware usage while computing the properties of a Markov chain instance.</p>
<fig id="pone.0147935.g002" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g002</object-id>
<label>Fig 2</label>
<caption>
<title>Typical hardware usage for our experiments.</title>
<p>At first, the state graph is being constructed as a sequential task. Afterwards, the properties of the state graph are being computed in parallel. When each property is computed the next instance is processed in the same manner.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g002" xlink:type="simple"/>
</fig>
</sec>
<sec id="sec028">
<title>Enumeration Experiment</title>
<p>In our first experiment, we wanted to gain an impression concerning the dimension of the total mixing time and its bounds.</p>
<sec id="sec029">
<title>Experimental Setup</title>
<p>Firstly, we enumerated all small input instances up to a given limit for each chain. In particular, we enumerated 19,378 bipartite degree sequence pairs with up to 6+6 vertices as input for the switch chains and 89,242 connected non-isomorphic bipartite graphs with 6+6 vertices as input for the matching chains. While the first task was done with a simple backtracking procedure, the latter task was done by the command line tool <italic>nauty</italic>[<xref ref-type="bibr" rid="pone.0147935.ref026">26</xref>]. These combinatorial objects served as input instances for the Markov chains. Even though the size of input is small, the resulting state graphs can be large. For example, the largest state graph processed in this experiment had 297,200 states and corresponds to the regular degree sequence pair (3, 3, 3, 3, 3, 3),(3, 3, 3, 3, 3, 3). Since both the number of instances, as well as the size of the state graphs grow exponentially, we were not able to perform such an experiment for a much larger instance size. For each instance, we constructed the corresponding state graph. For all state graphs with a maximum of 20,000 states, we computed the following properties: a) total mixing time, b) spectral bound, and c) canonical path congestion bound. Although we could easily compute the latter bounds for much larger state graphs, we did not do so, since we need the total mixing time for comparison.</p>
</sec>
<sec id="sec030">
<title>Results</title>
<p>In <xref ref-type="fig" rid="pone.0147935.g003">Fig 3</xref>, we show the results of the enumeration experiment. Each input instance corresponds to two data points, showing the ratio of the upper spectral bound (green), and congestion bound (blue) with the total mixing time. We immediately observe that the spectral bound is very close to the total mixing time for all instances, in contrast to the congestion bound. More precisely, in case of Matching Chain Two, the congestion bound is up to 800 times larger than the total mixing time. Similar observations can be made for the other chains.</p>
<fig id="pone.0147935.g003" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g003</object-id>
<label>Fig 3</label>
<caption>
<title>The quality of the upper bounds.</title>
<p>The quotient of congestion bound (blue) and total mixing time, respectively upper spectral bound (green) and total mixing time versus the size of the corresponding state graph.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g003" xlink:type="simple"/>
</fig>
<p>In <xref ref-type="fig" rid="pone.0147935.g004">Fig 4</xref>, we highlight the instances which are known to have a polynomial congestion bound. In the case of the switch chains, these are regular and half-regular degree sequences. In the case of Matching Chain One, these are dense bipartite graphs. Matching Chain Two is known to be rapidly mixing for all instances. We find that the observations can also be confirmed within this set.</p>
<fig id="pone.0147935.g004" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g004</object-id>
<label>Fig 4</label>
<caption>
<title>The quality of the upper bounds for rapidly mixing instances.</title>
<p>The results of <xref ref-type="fig" rid="pone.0147935.g003">Fig 3</xref> filtered to highlight instances with known polynomial mixing time. Instances with no known polynomial bound are coloured gray.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g004" xlink:type="simple"/>
</fig>
</sec>
</sec>
<sec id="sec031">
<title>Scaling Experiment</title>
<p>We wanted to know whether the observed effects remain valid for larger instances. The main problem is, that the number of instances for our Markov chains, both degree sequences and bipartite graphs, grows exponentially with input size. So, a complete enumeration becomes infeasible when the instance size grows. To gain some insights, we picked selected instances for the switch chains and scaled them to larger size.</p>
<sec id="sec032">
<title>Experimental Setup</title>
<p>We picked a half-regular sequence pattern (<italic>n</italic> − 1, <italic>n</italic> − 2, 2, 1), (2, 2, …, 2), where the number of two’s in the second sequence is <italic>n</italic>. The parameter <italic>n</italic> can be used to scale the instance to different sizes. In doing so, a bipartite graph which realizes this degree sequences has <italic>n</italic> + 4 vertices and 2<italic>n</italic> edges. These sequence pairs are half-regular and so, it is known that the switch chains are rapidly mixing. For each <italic>n</italic> between 4 and 50, we constructed the corresponding state graph and computed the total mixing time and its bounds. Again, due to the large memory consumption, we stopped computing the total mixing time when |Ω| exceeded 20,000. To predict missing values of total mixing time for larger state graphs up to about 600,000 states, we used a linear model based on the following observation.</p>
</sec>
<sec id="sec033">
<title>Results</title>
<p>We observed that the lower spectral bound seems to have a linear relationship with the total mixing time. This allowed us to predict the missing total mixing time values using a simple linear model (see <xref ref-type="fig" rid="pone.0147935.g005">Fig 5</xref> for details).</p>
<fig id="pone.0147935.g005" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g005</object-id>
<label>Fig 5</label>
<caption>
<title>Relationship between the lower spectral bound and the total mixing time.</title>
<p>The total mixing time is shown in connection to a corresponding lower spectral bound for sequence pairs of the form (<italic>n</italic> − 1, <italic>n</italic> − 2, 2, 1), (2, 2, …, 2). We use the displayed formulas to predict missing values for total mixing time.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g005" xlink:type="simple"/>
</fig>
<p>To quantify the gap between the bounds and total mixing time, we again divided each bound through the corresponding total mixing time or its predicted value. <xref ref-type="fig" rid="pone.0147935.g006">Fig 6</xref> shows the result of this experiment. We observed that the gap between the congestion bound and the total mixing time grows with input size <italic>n</italic>. Furthermore, we observed that the same is true for the upper spectral bound, but in a much slower way.</p>
<fig id="pone.0147935.g006" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g006</object-id>
<label>Fig 6</label>
<caption>
<title>Quality of the upper bounds with growing instance size.</title>
<p>The quotient of congestion bound (blue), respectively upper spectral bound (green) with total mixing time is shown as a function of the instance size. A dotted line shows the point where we stop computing the total mixing time and start using the lower spectral bound approximation.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g006" xlink:type="simple"/>
</fig>
<p>We repeated this experiment with other half-regular sequence patterns and observed similar effects. In particular, we changed our sequence pattern (<italic>n</italic> − 1, <italic>n</italic> − 2, 2, 1), (2, 2, …, 2), which we call type A, slightly to the sequences patterns (<italic>n</italic> − 1, <italic>n</italic> − 2, 3), (2, 2, …, 2) (type B) and (<italic>n</italic> − 1, <italic>n</italic> − 2, 1, 1, 1), (2, 2, …, 2) (type C). <xref ref-type="fig" rid="pone.0147935.g007">Fig 7</xref> shows the, partially estimated, total mixing time for each sequence type. We observed that each type has its own growing asymptotic. The data suggests, in the case of Switch Chain One, the total mixing time of sequence type A grows with <italic>O</italic>(<italic>n</italic><sup>2.27</sup>), of type B with <italic>O</italic>(<italic>n</italic><sup>1.16</sup>), and of type C with <italic>O</italic>(<italic>n</italic><sup>2.43</sup>). In the case of Switch Chain Two, we observe similar effects.</p>
<fig id="pone.0147935.g007" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g007</object-id>
<label>Fig 7</label>
<caption>
<title>Growing asymptotic for the total mixing time of half-regular sequence pairs.</title>
<p>The observed mixing time curves for the degree sequence pairs of type A are coloured violet, of type B red, and of type C orange.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g007" xlink:type="simple"/>
</fig>
<p>These results are interesting because these bounds are lower bounds on the mixing time of the switch chains for all half-regular sequence pairs. Since two of them are clearly super-linear, a random walk with a linear number of steps must ultimately fail and will result in a non-random sample.</p>
</sec>
</sec>
<sec id="sec034">
<title>Loop Reduction Experiment</title>
<p>From the data of the enumeration experiment, we observed that the total mixing time does not correlate with the size of the state graph (see <xref ref-type="fig" rid="pone.0147935.g008">Fig 8</xref>). Instead, the largest mixing time appears at input instances corresponding to small state graphs.</p>
<fig id="pone.0147935.g008" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g008</object-id>
<label>Fig 8</label>
<caption>
<title>Number of states versus total mixing time.</title>
<p>Each data point represents one input instance from our set of input instance. Instances with known polynomial mixing time are highlighted red.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g008" xlink:type="simple"/>
</fig>
<p>For example, the sequence pair (6, 6, 6, 6, 5, 5),(6, 6, 6, 6, 5, 5), possesses just two different states but is beneath the instances with largest total mixing time in both switch chains. To explain this effect, consider sequence pairs of the general form (<italic>n</italic>, <italic>n</italic>,…, <italic>n</italic> − 1, <italic>n</italic> − 1), (<italic>n</italic>, <italic>n</italic>, …, <italic>n</italic> − 1, <italic>n</italic> − 1), where 2<italic>n</italic> is the number of vertices in the corresponding bipartite graph. It is apparent that such sequence pairs posses two different realizations, meaning, their state graph have two states. Now consider Switch Chain One; for a given <italic>n</italic>, the number of ways to choose <italic>i</italic>, <italic>j</italic>, <italic>k</italic>, <italic>l</italic> is (<italic>n</italic> ⋅ (<italic>n</italic> + 1)/2)<sup>2</sup> ∈ <italic>O</italic>(<italic>n</italic><sup>4</sup>). Due to the large number of edges in the sequence pairs, all but one of these choices result in loops. As a consequence, the expected number of steps, just to get from one state to the other, is <italic>O</italic>(<italic>n</italic><sup>4</sup>), which is immediately a lower bound for the mixing time of Switch Chain One. The fact that an instance with polynomially bounded total mixing time makes the largest mixing time over all instances is likely an effect of the small input size. To better understand this effect, we decided to further reduce the influence of the loops.</p>
<sec id="sec035">
<title>Experimental Setup</title>
<p>We repeated the enumeration experiment but made some artificial modifications on each state graph before computing its properties. For each state graph we determined the minimal loop probability over all states <italic>P</italic><sub>min</sub>: = min<sub><italic>i</italic>∈Ω</sub> <italic>P</italic><sub><italic>ii</italic></sub>. We wanted to reduce the transition probability of each loop in the state graph by this quantity. However, to avoid the removal of all loops and possible problems with convergence, we removed only 99% of this probability from the loops. This way, we gained new transition probabilities of
<disp-formula id="pone.0147935.e056"><alternatives><graphic id="pone.0147935.e056g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e056" xlink:type="simple"/><mml:math display="block" id="M56"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:msubsup><mml:mi>P</mml:mi> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>i</mml:mi></mml:mrow> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>←</mml:mo> <mml:msub><mml:mi>P</mml:mi> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>i</mml:mi></mml:mrow></mml:msub> <mml:mo>-</mml:mo> <mml:mo>.</mml:mo> <mml:mn>99</mml:mn> <mml:msub><mml:mi>P</mml:mi> <mml:mo form="prefix" movablelimits="true">min</mml:mo></mml:msub> <mml:mtext> for all </mml:mtext> <mml:mi>i</mml:mi> <mml:mo>∈</mml:mo> <mml:mo>Ω</mml:mo> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(14)</label></disp-formula>
The amount of.99<italic>P</italic><sub>min</sub> which was reduced from the probability mass of each state, was restored to the network through rescaling of the remaining transition arcs:
<disp-formula id="pone.0147935.e057"><alternatives><graphic id="pone.0147935.e057g" mimetype="image" position="anchor" xlink:href="info:doi/10.1371/journal.pone.0147935.e057" xlink:type="simple"/><mml:math display="block" id="M57"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd columnalign="right"><mml:mrow><mml:msubsup><mml:mi>P</mml:mi> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>j</mml:mi></mml:mrow> <mml:mo>′</mml:mo></mml:msubsup> <mml:mo>←</mml:mo> <mml:mfrac><mml:msub><mml:mi>P</mml:mi> <mml:mrow><mml:mi>i</mml:mi> <mml:mi>j</mml:mi></mml:mrow></mml:msub> <mml:mrow><mml:mn>1</mml:mn> <mml:mo>-</mml:mo> <mml:mo>.</mml:mo> <mml:mn>99</mml:mn> <mml:msub><mml:mi>P</mml:mi> <mml:mo form="prefix" movablelimits="true">min</mml:mo></mml:msub></mml:mrow></mml:mfrac> <mml:mtext> for all </mml:mtext> <mml:mi>i</mml:mi> <mml:mo>,</mml:mo> <mml:mi>j</mml:mi> <mml:mo>∈</mml:mo> <mml:mo>Ω</mml:mo> <mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></alternatives> <label>(15)</label></disp-formula>
By subtracting the same amount of probability from each loop, we kept the symmetry of the transition matrix so that the chain’s stationary distribution was still uniform. The result was a state graph with the same structure but drastically reduced loop probability. In such state graphs, the mixing times are much more dependent on the structure of the state graph than on the number of the loops. We repeated the computation of the total mixing time and its upper bounds with those modified state graphs for Switch Chain One.</p>
</sec>
<sec id="sec036">
<title>Results</title>
<p>We first observed that the modification indeed had a strong effect on the total mixing time (see <xref ref-type="fig" rid="pone.0147935.g009">Fig 9</xref>).</p>
<fig id="pone.0147935.g009" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g009</object-id>
<label>Fig 9</label>
<caption>
<title>Influence of the average loop probability on the total mixing time.</title>
<p>Each data point represents a state graph, for each input instance of Switch Chain One, before and after loop reduction.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g009" xlink:type="simple"/>
</fig>
<p>While the largest total mixing time in our instance set is about 1400, in the set of reduced state graphs, it is 63. In addition, we observed that the total mixing time after the reduction steps no longer correlates with the average loop probability. So, the effects we observe now are more or less detached from the influence of the loops. We observed, that the effect we observed in the enumeration experiment still remain (see <xref ref-type="fig" rid="pone.0147935.g010">Fig 10</xref>). The quality of the congestion bound is still bad while the largest total mixing time occurs at relatively small state graphs.</p>
<fig id="pone.0147935.g010" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g010</object-id>
<label>Fig 10</label>
<caption>
<title>Properties of reduced state graphs.</title>
<p>(A) Size of a state graph versus its total mixing time. Regular and half-regular sequence pairs are highlighted red. (B) Quotient of congestion bound (blue) and upper spectral bound (green) with corresponding total mixing time.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g010" xlink:type="simple"/>
</fig>
<p>We finished our experiments with the observation that the upper spectral bound as well as the congestion bound heavily depend on the average vertex degree of the state graph (see <xref ref-type="fig" rid="pone.0147935.g011">Fig 11</xref>). We concluded that the average degree is a structural property of a state graph which has a stronger influence on the total mixing time than its size.</p>
<fig id="pone.0147935.g011" position="float">
<object-id pub-id-type="doi">10.1371/journal.pone.0147935.g011</object-id>
<label>Fig 11</label>
<caption>
<title>Influence of the average vertex degree.</title>
<p>Connection between average vertex degree of a state graph and its total mixing time, respectively canonical path bound.</p>
</caption>
<graphic mimetype="image" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.g011" xlink:type="simple"/>
</fig>
</sec>
</sec>
</sec>
<sec id="sec037" sec-type="conclusions">
<title>Results and Discussion</title>
<p>We introduced the <italic>marathon</italic> library and demonstrated how it can be used to support the analysis of sampling algorithms by a set of experiments. We briefly summarise the most important observations from our experiments:</p>
<list list-type="bullet">
<list-item>
<p>The congestion bound is much larger than the total mixing time in almost all cases. The quality of the congestion bounds deteriorates with growing input size. This observation is made in reduced and non-reduced state graphs.</p>
</list-item>
<list-item>
<p>The upper spectral bound keeps close to total mixing time even when the input size grows, although it can be observed, that its quality drops slowly. Again, this observation is made in reduced and non-reduced state graphs.</p>
</list-item>
<list-item>
<p>The lower spectral bound seems to have an almost linear relationship with the total mixing time. This way, it can be used to precisely predict the total mixing time. The search for an explanation of this effect is likely a good subject for further theoretical studies.</p>
</list-item>
<list-item>
<p>Maybe the most surprising observation made in our experiments is that large total mixing time tends to occur at small state graphs.</p>
</list-item>
<list-item>
<p>The average vertex degree of a state graph has a strong relationship on its total mixing time. This observation should be investigated further. Figuring out which sequences have a tendency towards more diverse vertex degrees in their state graphs could lead to further interesting rapidly mixing graph classes.</p>
</list-item>
</list>
<p>Our observations indicate that the theoretical bound gained by the canonical path method is likely too pessimistic. Moreover, although we know the exact structure of a state graph in our experiments, which can never be the case in a normal practical scenario, the congestion bound is too large. This leads us to the conclusion that the canonical path method will never yield applicable values. Furthermore, this gives hope to the hypothesis, that the true total mixing time is smaller than existing theory is able to prove. So, we are optimistic about the applicability of the switch chains. We think that a promising next step could be to focus on two fields which need one another: investigating and the proving of special structures for state graphs depending on the problem and figuring out new relationships between structures of graphs and its eigenvalues.</p>
<sec id="sec038">
<title>Future Work</title>
<p>One of our next steps is to use our new tool very extensively. We want to investigate further chains and test further hypotheses. Moreover, we plan to add further functionality to the <italic>marathon</italic> library to enable additional research questions. For example, we want to compute the distribution of the mixing time. While the total mixing time displays the maximal number of steps necessary to drop below a total variation distance of <italic>ϵ</italic>, the mixing time as a function of the starting state would lead to further insights, such as average mixing time. Another additional feature would be the computation of a multi commodity flow congestion scheme, which is a generalization of the canonical path method. Furthermore, we want to improve the performance of existing methods. In particular, we want to add multi GPU support as well as a parallel method for the construction of the state graph. Another topic would be the parallel evaluation of the canonical path congestion method using GPUs.</p>
</sec>
</sec>
<sec id="sec039">
<title>Supporting Information</title>
<supplementary-material id="pone.0147935.s001" mimetype="application/zip" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.s001" xlink:type="simple">
<label>S1 Dataset</label>
<caption>
<title>Results of the enumeration experiment.</title>
<p>The results of the enumeration experiment as comma separated value files.</p>
<p>(ZIP)</p>
</caption>
</supplementary-material>
<supplementary-material id="pone.0147935.s002" mimetype="application/zip" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.s002" xlink:type="simple">
<label>S2 Dataset</label>
<caption>
<title>Results of the scaling experiment.</title>
<p>The results of the scaling experiment as comma separated value files.</p>
<p>(ZIP)</p>
</caption>
</supplementary-material>
<supplementary-material id="pone.0147935.s003" mimetype="application/zip" position="float" xlink:href="info:doi/10.1371/journal.pone.0147935.s003" xlink:type="simple">
<label>S3 Dataset</label>
<caption>
<title>Results of the loop reduction experiment.</title>
<p>The results of the loop reduction experiment as a comma separated value file.</p>
<p>(ZIP)</p>
</caption>
</supplementary-material>
</sec>
</body>
<back>
<ack>
<p>We would like to thank Matthias Müller-Hannemann for his remarks and suggestions, as well as for the fruitful discussions.</p>
</ack>
<ref-list>
<title>References</title>
<ref id="pone.0147935.ref001">
<label>1</label>
<mixed-citation publication-type="other" xlink:type="simple">Kashtan N, Itzkovitz S, Milo R, Alon U. mfinder: Network motif detection tool; 2005. Available from: <ext-link ext-link-type="uri" xlink:href="http://www.weizmann.ac.il/mcb/UriAlon/" xlink:type="simple">http://www.weizmann.ac.il/mcb/UriAlon/</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref002">
<label>2</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Gotelli</surname> <given-names>NJ</given-names></name>. <article-title>Null Model Analysis of Species Co-Occurrence Patterns</article-title>. <source>Ecology</source>. <year>2000</year>;<volume>81</volume>(<issue>9</issue>):<fpage>2606</fpage>–<lpage>2621</lpage>. Available from: <ext-link ext-link-type="uri" xlink:href="http://www.jstor.org/stable/177478" xlink:type="simple">http://www.jstor.org/stable/177478</ext-link>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1890/0012-9658(2000)081%5B2606:NMAOSC%5D2.0.CO;2" xlink:type="simple">10.1890/0012-9658(2000)081%5B2606:NMAOSC%5D2.0.CO;2</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref003">
<label>3</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Jerrum</surname> <given-names>MR</given-names></name>, <name name-style="western"><surname>Valiant</surname> <given-names>LG</given-names></name>, <name name-style="western"><surname>Vazirani</surname> <given-names>VV</given-names></name>. <article-title>Random generation of combinatorial structures from a uniform distribution</article-title>. <source>Theoretical Computer Science</source>. <year>1986</year>;<volume>43</volume>:<fpage>169</fpage>–<lpage>188</lpage>. Available from: <ext-link ext-link-type="uri" xlink:href="http://www.sciencedirect.com/science/article/pii/030439758690174X" xlink:type="simple">http://www.sciencedirect.com/science/article/pii/030439758690174X</ext-link>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1016/0304-3975(86)90174-X" xlink:type="simple">10.1016/0304-3975(86)90174-X</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref004">
<label>4</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Diaconis</surname> <given-names>P</given-names></name>. <article-title>The markov chain monte carlo revolution</article-title>. <source>Bulletin of the American Mathematical Society</source>. <year>2009</year>;<volume>46</volume>(<issue>2</issue>):<fpage>179</fpage>–<lpage>205</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1090/S0273-0979-08-01238-X" xlink:type="simple">10.1090/S0273-0979-08-01238-X</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref005">
<label>5</label>
<mixed-citation publication-type="book" xlink:type="simple">
<name name-style="western"><surname>Sinclair</surname> <given-names>A</given-names></name>. <chapter-title>Improved bounds for mixing rates of Markov chains and multicommodity flow</chapter-title>. In: <name name-style="western"><surname>Simon</surname> <given-names>I</given-names></name>, editor. <source>LATIN’92. vol. 583 of Lecture Notes in Computer Science</source>. <publisher-name>Springer</publisher-name> <publisher-loc>Berlin Heidelberg</publisher-loc>; <year>1992</year>. p. <fpage>474</fpage>–<lpage>487</lpage>. Available from: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1007/BFb0023849" xlink:type="simple">http://dx.doi.org/10.1007/BFb0023849</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref006">
<label>6</label>
<mixed-citation publication-type="other" xlink:type="simple">Sinclair A. CS294: Markov Chain Monte Carlo: Foundations &amp; Applications; 2009. Last visited on March 2014. <ext-link ext-link-type="uri" xlink:href="http://www.cs.berkeley.edu/~sinclair/cs294/f09.html" xlink:type="simple">http://www.cs.berkeley.edu/~sinclair/cs294/f09.html</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref007">
<label>7</label>
<mixed-citation publication-type="book" xlink:type="simple">
<name name-style="western"><surname>Levin</surname> <given-names>DA</given-names></name>, <name name-style="western"><surname>Peres</surname> <given-names>Y</given-names></name>, <name name-style="western"><surname>Wilmer</surname> <given-names>EL</given-names></name>. <source>Markov chains and mixing times</source>. <publisher-name>American Mathematical Society</publisher-name>; <year>2006</year>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref008">
<label>8</label>
<mixed-citation publication-type="book" xlink:type="simple">
<name name-style="western"><surname>Lovász</surname> <given-names>L</given-names></name>. <chapter-title>Random Walks on Graphs: A Survey</chapter-title>. In: <name name-style="western"><surname>Miklós</surname> <given-names>D</given-names></name>, <name name-style="western"><surname>Sós</surname> <given-names>VT</given-names></name>, <name name-style="western"><surname>Szőnyi</surname> <given-names>T</given-names></name>, editors. <source>Combinatorics, Paul Erdős is Eighty</source>. <volume>vol. 2</volume>. <publisher-loc>Budapest</publisher-loc>: <publisher-name>János Bolyai Mathematical Society</publisher-name>; <year>1996</year>. p. <fpage>353</fpage>–<lpage>398</lpage>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref009">
<label>9</label>
<mixed-citation publication-type="other" xlink:type="simple">Nvidia. CUDA Toolkit; 2015. Available from: <ext-link ext-link-type="uri" xlink:href="https://developer.nvidia.com/cuda-toolkit" xlink:type="simple">https://developer.nvidia.com/cuda-toolkit</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref010">
<label>10</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Dagum</surname> <given-names>L</given-names></name>, <name name-style="western"><surname>Menon</surname> <given-names>R</given-names></name>. <article-title>OpenMP: An Industry-Standard API for Shared-Memory Programming</article-title>. <source>IEEE Comput Sci Eng</source>. <year>1998</year> <month>Jan</month>;<volume>5</volume>(<issue>1</issue>):<fpage>46</fpage>–<lpage>55</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1109/99.660313" xlink:type="simple">10.1109/99.660313</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref011">
<label>11</label>
<mixed-citation publication-type="other" xlink:type="simple">Xianyi Z. openBLAS; 2015. Available from: <ext-link ext-link-type="uri" xlink:href="http://www.openblas.net/" xlink:type="simple">http://www.openblas.net/</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref012">
<label>12</label>
<mixed-citation publication-type="other" xlink:type="simple">Nvidia. cuBLAS; 2015. Available from: <ext-link ext-link-type="uri" xlink:href="https://developer.nvidia.com/cublas" xlink:type="simple">https://developer.nvidia.com/cublas</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref013">
<label>13</label>
<mixed-citation publication-type="other" xlink:type="simple">Nvidia. cuBLAS-XT; 2015. Available from: <ext-link ext-link-type="uri" xlink:href="https://developer.nvidia.com/cublasxt" xlink:type="simple">https://developer.nvidia.com/cublasxt</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref014">
<label>14</label>
<mixed-citation publication-type="book" xlink:type="simple">
<name name-style="western"><surname>Lehoucq</surname> <given-names>RB</given-names></name>, <name name-style="western"><surname>Sorensen</surname> <given-names>DC</given-names></name>, <name name-style="western"><surname>Yang</surname> <given-names>C</given-names></name>. <source>Arpack User’s Guide: Solution of Large-Scale Eigenvalue Problems With Implicityly Restorted Arnoldi Methods (Software, Environments, Tools)</source>. <publisher-name>Soc for Industrial &amp; Applied Math</publisher-name>;. Available from: <ext-link ext-link-type="uri" xlink:href="http://www.worldcat.org/isbn/0898714079" xlink:type="simple">http://www.worldcat.org/isbn/0898714079</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref015">
<label>15</label>
<mixed-citation publication-type="other" xlink:type="simple">Broder AZ. How hard is it to marry at random? (On the approximation of the permanent). In: Proceedings of the Eighteenth Annual ACM Symposium on Theory of Computing. STOC’86. New York, NY, USA: ACM; 1986. p. 50–58. Available from: <ext-link ext-link-type="uri" xlink:href="http://doi.acm.org/10.1145/12130.12136" xlink:type="simple">http://doi.acm.org/10.1145/12130.12136</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref016">
<label>16</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Jerrum</surname> <given-names>M</given-names></name>, <name name-style="western"><surname>Sinclair</surname> <given-names>A</given-names></name>. <article-title>Approximating the permanent</article-title>. <source>SIAM J Comput</source>. <year>1989</year> <month>Dec</month>;<volume>18</volume>(<issue>6</issue>):<fpage>1149</fpage>–<lpage>1178</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1137/0218077" xlink:type="simple">10.1137/0218077</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref017">
<label>17</label>
<mixed-citation publication-type="other" xlink:type="simple">Diaconis P, Graham R, Holmes SP. Statistical problems involving permutations with restricted positions. In: IMS Lecture Notes Monogr. Ser; 1999. p. 195–222.</mixed-citation>
</ref>
<ref id="pone.0147935.ref018">
<label>18</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Jerrum</surname> <given-names>M</given-names></name>, <name name-style="western"><surname>Sinclair</surname> <given-names>A</given-names></name>, <name name-style="western"><surname>Vigoda</surname> <given-names>E</given-names></name>. <article-title>A polynomial-time approximation algorithm for the permanent of a matrix with nonnegative entries</article-title>. <source>Journal of the ACM</source>. <year>2004</year>;<volume>51</volume>:<fpage>671</fpage>–<lpage>697</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1145/1008731.1008738" xlink:type="simple">10.1145/1008731.1008738</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref019">
<label>19</label>
<mixed-citation publication-type="other" xlink:type="simple">Bezáková I, Stefankovič D, Vazirani VV, Vigoda E. Accelerating Simulated Annealing for the Permanent and Combinatorial Counting Problems. In: In Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA). ACM Press; 2006. p. 900–907.</mixed-citation>
</ref>
<ref id="pone.0147935.ref020">
<label>20</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Tutte</surname> <given-names>WT</given-names></name>. <article-title>The factors of graphs</article-title>. <source>Canadian J of Mathematics</source>. <year>1952</year>;<volume>4</volume>:<fpage>314</fpage>–<lpage>328</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.4153/CJM-1952-028-2" xlink:type="simple">10.4153/CJM-1952-028-2</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref021">
<label>21</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Kannan</surname> <given-names>R</given-names></name>, <name name-style="western"><surname>Tetali</surname> <given-names>P</given-names></name>, <name name-style="western"><surname>Vempala</surname> <given-names>S</given-names></name>. <article-title>Simple Markov-chain algorithms for generating bipartite graphs and tournaments</article-title>. <source>Random Structures &amp; Algorithms</source>. <year>1999</year>;<volume>14</volume>(<issue>4</issue>):<fpage>293</fpage>–<lpage>308</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1002/(SICI)1098-2418(199907)14:4%3C293::AID-RSA1%3E3.3.CO;2-7" xlink:type="simple">10.1002/(SICI)1098-2418(199907)14:4%3C293::AID-RSA1%3E3.3.CO;2-7</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref022">
<label>22</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Petersen</surname> <given-names>J</given-names></name>. <article-title>Die Theorie der regulären graphs</article-title>. <source>Acta Mathematica</source>. <year>1891</year>;<volume>15</volume>:<fpage>193</fpage>–<lpage>220</lpage>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1007/BF02392606" xlink:type="simple">10.1007/BF02392606</ext-link></comment></mixed-citation>
</ref>
<ref id="pone.0147935.ref023">
<label>23</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>Miklós</surname> <given-names>I</given-names></name>, <name name-style="western"><surname>Erdös</surname> <given-names>PL</given-names></name>, <name name-style="western"><surname>Soukup</surname> <given-names>L</given-names></name>. <article-title>Towards Random Uniform Sampling of Bipartite Graphs with given Degree Sequence</article-title>. <source>Electr J Comb</source>. <year>2013</year>;<volume>20</volume>(<issue>1</issue>).</mixed-citation>
</ref>
<ref id="pone.0147935.ref024">
<label>24</label>
<mixed-citation publication-type="other" xlink:type="simple">Greenhill CS. The switch Markov chain for sampling irregular graphs (Extended Abstract). In: Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015; 2015. p. 1564–1572. Available from: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1137/1.9781611973730.103" xlink:type="simple">http://dx.doi.org/10.1137/1.9781611973730.103</ext-link>.</mixed-citation>
</ref>
<ref id="pone.0147935.ref025">
<label>25</label>
<mixed-citation publication-type="other" xlink:type="simple">Berger A, Müller-Hannemann M. Uniform sampling of digraphs with a fixed degree sequence. In: Proceedings of the 36th International Conference on Graph-Theoretic Concepts in Computer Science. WG’10. Berlin, Heidelberg: Springer-Verlag; 2010. p. 220–231. Full version available from Arxiv:0912.0685v3.</mixed-citation>
</ref>
<ref id="pone.0147935.ref026">
<label>26</label>
<mixed-citation publication-type="journal" xlink:type="simple">
<name name-style="western"><surname>McKay</surname> <given-names>BD</given-names></name>, <name name-style="western"><surname>Piperno</surname> <given-names>A</given-names></name>. <article-title>Practical graph isomorphism, (II)</article-title>. <source>Journal of Symbolic Computation</source>. <year>2014</year>;<volume>60</volume>(<issue>0</issue>):<fpage>94</fpage>–<lpage>112</lpage>. Available from: <ext-link ext-link-type="uri" xlink:href="http://www.sciencedirect.com/science/article/pii/S0747717113001193" xlink:type="simple">http://www.sciencedirect.com/science/article/pii/S0747717113001193</ext-link>. <comment>doi: <ext-link ext-link-type="uri" xlink:href="http://dx.doi.org/10.1016/j.jsc.2013.09.003" xlink:type="simple">10.1016/j.jsc.2013.09.003</ext-link></comment></mixed-citation>
</ref>
</ref-list>
</back>
</article>