The matrix that is a graph

Every bridge is a coupon

On a row of cliques joined by single edges, sampling edges until the graph is connected is a coupon collector over the bridges. Uniform sampling needs m ln 10(c − 1) samples for nine draws in ten, to within one per cent at 32 cliques, and connects under one draw in a hundred at q = m. Exact resistance needs n ln 10(c − 1). The gap between them is m over n, 3.6 at every length of chain, and it widens with the size of the cliques instead: 1.6, 3.6, 7.3 and 13.4 at cliques of 4, 8, 16 and 32. The two-solve sketch does not fail on the chain, because a random projection of a bridge's resistance is exact, to rounding, at any number of solves; what it pays for is inside the cliques. And counting common neighbours, which needs no solve, beats the exact resistance on every chain, until the clusters have no triangles in them, where it is uniform sampling under another name.

Worth reading first: A distance computed by a solve · A matrix with no numbers in it.

What the resistance was for took effective resistance sampling apart and found it doing one job that nothing cheaper did. On a complete graph and on a grid, uniform sampling kept the Laplacian’s spectrum as well as sampling by resistance. On two cliques joined by a single edge it did not, because it lost the bridge: the chance of missing an edge of probability PP in qq samples is (1−P)q(1 - P)^q, and that formula matched the disconnected draws for every rule and every sample count. Resistance sampling gives a bridge a large probability, because a bridge’s resistance is one and an edge inside a clique of twenty has resistance a tenth. That is all it was found to do.

A single bridge is one coupon to collect. That essay predicted, with a sign, what happens with many: on a row of small cliques joined end to end by single edges, uniform sampling should need about mlog⁡(cliques)m \log(\text{cliques}) samples to keep every bridge, so that it fails almost surely below q=mq = m; exact resistance should need about nlog⁡nn \log n; the gap between them should widen as the chain grows; and the two-solve sketch, which found the single bridge, should fail on the chain, “since a chain gives it many chances for one bad estimate”. It also predicted that a rule with no solve in it at all, one over the number of common neighbours of an edge’s endpoints plus one, would find the single bridge nearly always and do no worse than uniform on the grid.

Two of those hold exactly. The gap does not widen, and the sketch does not fail, and the reason the sketch does not fail corrects a sentence in the earlier essay.

One number per draw

Connection is the whole question here, so a draw is reduced to one number: sample edges with replacement, by the rule’s probabilities, until the sampled graph is connected, and record how many it took. Four hundred draws give that number’s distribution, and its 90th percentile is the sample count at which nine draws in ten are connected. A union–find structure makes this cheap enough to run on graphs of 256 vertices and four thousand edges for every rule. It is the same bookkeeping a traversal does to count connected components, applied one sampled edge at a time.

The chains are cc cliques of eight vertices in a row, the last vertex of each joined to the first of the next, so there are c−1c - 1 bridges, n=8cn = 8c vertices and m=29c−1m = 29c - 1 edges. Every bridge has resistance one. Every edge inside a clique of eight has resistance 2/82/8, since the bridges are cuts and current between two vertices of one clique never leaves it. So resistance sampling gives each bridge 1/(n−1)1/(n-1) of the probability, by Foster’s theorem that the resistances sum to n−1n - 1, and uniform sampling gives it 1/m1/m. The exact values come from one factorisation of the Laplacian grounded at a vertex, which is the vertex nobody solves for put to the use it was introduced for.

On 16 cliques of eight vertices joined in a row by single edges, the share of four hundred draws whose sample is connected, against the number of edges sampled, for four rulesexact resistance: nine in ten connected at 641 samples, half at 442; uniform: nine in ten connected at 2300 samples, half at 1429; common neighbours: nine in ten connected at 555 samples, half at 425; sketched, 2 solves: nine in ten connected at 881 samples, half at 596. The graph has 128 vertices and 463 edges, 15 of them bridges.1.522.533.50255075100log₁₀ of the edges sampled, qper cent of draws connectedexact resistanceuniformcommon neighbourssketched, 2 solves128 vertices · 463 edges, 15 of them bridgesevery bridge is a coupon
Fig. 1 On a chain of cliques of eight, the share of four hundred draws connected against the edges sampled, for four rules. The dial sets the number of cliques.

At sixteen cliques, 128 vertices and 463 edges, exact resistance has nine draws in ten connected at 641 samples, and uniform at 2,300. The curves are steep, each rising from nothing to everything across about a factor of two in qq, which is what a coupon collector’s curve looks like once there are more than a few coupons. Turning the dial moves all four curves to the right together. Their order never changes and their spacing hardly does.

The coupon collector, exactly

For uniform sampling the bridges are the whole story. Each of the c−1c - 1 bridges is missed by qq samples with probability (1−1/m)q≈e−q/m(1 - 1/m)^q \approx e^{-q/m}, and treating the misses as independent, all of them are drawn with probability nine in ten when q≈mln⁡10(c−1)q \approx m \ln 10(c-1). That is the prediction’s mlog⁡(cliques)m \log(\text{cliques}) with its constant filled in.

The edges sampled before nine draws in ten are connected, against the number of cliques of eight in the chain, for five rules, with the coupon-collector count for uniform samplinguniform: 404 at 4, 989 at 8, 2300 at 16, 5344 at 32; degrees only: 438 at 4, 1083 at 8, 2805 at 16, 6130 at 32; sketched, 2 solves: 184 at 4, 383 at 8, 881 at 16, 2042 at 32; exact resistance: 119 at 4, 273 at 8, 641 at 16, 1482 at 32; common neighbours: 104 at 4, 260 at 8, 555 at 16, 1254 at 32; m ln 10(c − 1): 391, 981, 2320, 5318.234510²10³10⁴log₂ of the number of cliques: 4, 8, 16, 32samples for nine draws in tenuniformdegrees onlysketched, 2 solvesexact resistancecommon neighboursm ln 10(c − 1)cliques of eight · 400 drawsparallel lines: a constant ratio
Fig. 2 The samples for nine draws in ten connected, against the number of cliques, for five rules, with the coupon-collector count for uniform sampling.

The fit is close: at 4, 8, 16 and 32 cliques uniform needs 404, 989, 2,300 and 5,344 samples, and mln⁡10(c−1)m \ln 10(c - 1) is 391, 981, 2,320 and 5,318. And at q=mq = m, a sample as large as the graph, uniform connects 2 per cent of draws at eight cliques and none of four hundred at sixteen or thirty-two. So the first part of the prediction holds as stated: failure is near certain at any qq below mm once the chain has more than a few links.

Exact resistance follows the same law with n−1n - 1 in place of mm: 119, 273, 641 and 1,482 samples, against (n−1)ln⁡10(c−1)(n - 1)\ln 10(c - 1) of 105, 268, 636 and 1,463. The prediction said nlog⁡nn \log n. On these chains nln⁡nn \ln n is 111, 266, 621 and 1,420, nearly the same numbers, because 8c8c and 10(c−1)10(c - 1) are close, so this family cannot tell the two logarithms apart. What it can tell is that exact resistance spends its samples on the bridges just as uniform does, only at a rate m/(n−1)m/(n-1) higher.

Degrees, the rule 1/du+1/dv1/d_u + 1/d_v that needs no solve, is worse than uniform on every chain, 6,130 samples at thirty-two cliques. A bridge joins two vertices of degree eight while a clique edge joins two of degree seven, so the rule gives the bridges slightly less than their uniform share. It was a lower bound on the resistance in the earlier essay, and on this family it bounds it in the wrong direction for the edges that matter.

A gap set by the clique, not the chain

The prediction’s third claim was that the gap would widen as the chain lengthened. It does not move.

Uniform sampling's edges for nine draws in ten connected over exact resistance's, along chains of growing length and along chains of growing cliquesBy length: 3.39 at 4 cliques, 3.62 at 8 cliques, 3.59 at 16 cliques, 3.61 at 32 cliques. By clique size: 1.59 at 4, 3.62 at 8, 7.33 at 16, 13.45 at 32.124816chains of cliques of eight, by length4 cliques3.398 cliques3.6216 cliques3.5932 cliques3.61chains of eight cliques, by clique sizecliques of 41.59cliques of 83.62cliques of 167.33cliques of 3213.45uniform's samples over exact's, both at nine in ten400 draws eachthe gap is m over n, and the clique sets it
Fig. 3 Uniform sampling’s samples for nine draws in ten over exact resistance’s, along chains of growing length and along chains of growing cliques.

At 4, 8, 16 and 32 cliques of eight, uniform needs 3.39, 3.62, 3.59 and 3.61 times as many samples as exact resistance. Both are coupon collectors over the same c−1c - 1 bridges, so both carry the same ln⁡10(c−1)\ln 10(c - 1), and the ratio is the ratio of their per-bridge probabilities, m/(n−1)m/(n - 1), which for cliques of eight is (29c−1)/(8c−1)(29c - 1)/(8c - 1): 3.71 at four cliques and 3.64 at thirty-two. The chain’s length is in both numbers and cancels.

What does move the gap is the size of the cliques. At eight cliques of 4, 8, 16 and 32 vertices, the ratio is 1.59, 3.62, 7.33 and 13.4. An edge inside a clique of kk has resistance 2/k2/k, so the larger the clique, the smaller a share of the probability its edges deserve and the larger a share uniform sampling wastes on them. The gap is the density of the clusters, measured as edges per vertex, and a long chain of sparse clusters would show almost none. That is worth saying plainly because the prediction’s intuition, that a resistance’s advantage grows with the number of cuts, is the natural one, and it is wrong: the advantage per cut is fixed by how dense the neighbourhood of the cut is, and the number of cuts only multiplies the samples, for every rule alike.

The projection is exact on a bridge

The prediction about the sketch was the one with a mechanism in it. A sketched resistance projects the weighted incidence matrix onto kk random sign vectors, solves the Laplacian once for each, and reads an edge’s resistance as the squared potential drop across it summed over the kk solves. It is the dimension that does not appear applied to the columns of a resistance distance, and its spread at two solves is the spread any projection of that size has. The earlier essay measured its spread on two cliques and a bridge, from effectively zero to 6.3 times the true value at two solves, and wrote that “the bridge’s estimated resistance can be several times too large or too small”. With thirty-one bridges, one of them should come out small.

A sketched effective resistance over the exact one, on the bridges and on every other edge, from two and from eight random projections, on four graphs32 cliques of 8: 2 solves, bridges 1.0000 to 1.0000, other edges 0.000 to 5.625, median 0.625; 8 solves, bridges 1.0000 to 1.0000, other edges 0.094 to 3.656, median 1.000. 8 cliques of 32: 2 solves, bridges 1.0000 to 1.0000, other edges 0.000 to 10.906, median 0.625; 8 solves, bridges 1.0000 to 1.0000, other edges 0.055 to 3.430, median 0.922. two cliques of 20: 2 solves, bridges 1.0000 to 1.0000, other edges 0.000 to 5.800, median 0.800; 8 solves, bridges 1.0000 to 1.0000, other edges 0.150 to 2.550, median 0.925. two sparse clusters: 2 solves, bridges 1.0000 to 1.0000, other edges 0.001 to 4.093, median 0.767; 8 solves, bridges 1.0000 to 1.0000, other edges 0.234 to 2.242, median 0.907.0.010.111032 cliques of 82 solves, the bridges2 solves, every other edge8 solves, the bridges8 solves, every other edge8 cliques of 322 solves, the bridges2 solves, every other edge8 solves, the bridges8 solves, every other edgetwo cliques of 202 solves, the bridges2 solves, every other edge8 solves, the bridges8 solves, every other edgetwo sparse clusters2 solves, the bridges2 solves, every other edge8 solves, the bridges8 solves, every other edgesketched over exact · dot the median, bar the rangebelow 0.01 drawn at 0.01a projection is exact on a bridge
Fig. 4 A sketched resistance over the exact one, on the bridges and on every other edge, from two and from eight random projections, on four graphs.

None does. On every graph measured, and at two solves as at eight, every bridge’s sketched resistance equals its exact resistance to rounding. The other edges spread as the earlier essay said: at two solves from exactly zero to 5.6 times on thirty-two cliques of eight, and from zero to 10.9 on eight cliques of thirty-two.

The reason is short. A projection puts a random charge on each edge’s two endpoints, plus on one and minus on the other. A bridge separates the graph into two sides, and every edge other than the bridge has both endpoints on one side, so its charges cancel in the side’s total. The net charge on each side is the bridge’s own, ±1/k\pm 1/\sqrt k, and all of it must cross the bridge as current, through resistance one. The potential drop is therefore ±1/k\pm 1/\sqrt k exactly, whatever the other signs were, its square is 1/k1/k, and the kk squares sum to one. A sketch is exact on any edge that is a cut by itself, and the earlier essay’s sentence about the bridge’s estimate was a statement about the other 380 edges, carried over to the one it was not true of.

So the chain gives the sketch thirty-one chances for a bad bridge and it takes none of them. It still needs more samples than exact resistance, 2,042 against 1,482 at thirty-two cliques, but far fewer than uniform’s 5,344. The second half of the prediction fails in a way that makes the sketch stronger than the prediction assumed: on a graph whose thin cuts are bridges, two solves find all of them, exactly.

Where a cheap rule pays instead

If the sketch’s bridges are exact, its extra samples are going somewhere else.

On 32 cliques of eight in a row, the samples at which every bridge has been drawn with probability nine in ten, treating the bridges alone, beside the samples at which nine draws in ten are connected, for six rulesuniform: bridges alone 5269, measured 5344, least interior share 1.10; degrees only: bridges alone 5820, measured 6130, least interior share 1.06; sketched, 2 solves: bridges alone 1507, measured 2042, least interior share 0.38; sketched, 8 solves: bridges alone 1529, measured 1714, least interior share 0.46; exact resistance: bridges alone 1448, measured 1482, least interior share 1.00; common neighbours: bridges alone 902, measured 1254, least interior share 0.92.1000200040008000uniform: no vertex under 110% of its exact interior sharethe bridges alone5269the whole graph, measured5344degrees only: no vertex under 106% of its exact interior sharethe bridges alone5820the whole graph, measured6130sketched, 2 solves: no vertex under 38% of its exact interior sharethe bridges alone1507the whole graph, measured2042sketched, 8 solves: no vertex under 46% of its exact interior sharethe bridges alone1529the whole graph, measured1714exact resistance: no vertex under 100% of its exact interior sharethe bridges alone1448the whole graph, measured1482common neighbours: no vertex under 92% of its exact interior sharethe bridges alone902the whole graph, measured1254samples for nine draws in ten256 vertices · 927 edges · 31 bridgesa cheap rule pays inside the cliques
Fig. 5 On 32 cliques of eight, the samples at which every bridge has been drawn with probability nine in ten, treating the bridges alone, beside the samples at which nine draws in ten are connected, for six rules.

For uniform sampling and exact resistance the coupon count over the bridges alone is the measurement: 5,269 against 5,344, and 1,448 against 1,482. Collecting the bridges is collecting everything, since by the time the last bridge is drawn every clique has long been connected. For the two-solve sketch the bridges alone would take 1,507 samples, almost exactly exact resistance’s 1,448, and the measured count is 2,042. The difference is inside the cliques. Two random projections give some clique edges an estimate of zero, 25 of 896 on this graph, and leave some vertex with only 38 per cent of the share of probability exact resistance gives its clique edges. That vertex is the last to be connected, and it is connected later than any bridge is found. Eight solves raise the poorest vertex to 46 per cent and bring the count down to 1,714.

So the earlier essay’s two jobs of a crude resistance, finding the cut and “not disturbing the rest”, come apart on the chain more cleanly than they did on one bridge. Two solves do the first job perfectly. The second job is the one that costs, and it is a job about the edges inside dense clusters, which no sampling rule needs a resistance to get right; uniform sampling does it better than the sketch, at 110 per cent of the exact share for every vertex.

Common neighbours: a neighbourhood instead of a solve

The second prediction was about a rule that needs no solve. An edge whose endpoints share no neighbours looks, locally, like a bridge; an edge inside a dense cluster has endpoints that share almost everything. Weighting each edge by one over its common neighbours plus one should therefore give bridges a large probability at no cost but a count of triangles.

The edges sampled before nine draws in ten are connected, by exact resistance, by common neighbours and uniformly, on graphs with triangles and withouttwo cliques of 20, one bridge: exact resistance 133, common neighbours 121, uniform 954; 16 cliques of 8 in a row: exact resistance 641, common neighbours 555, uniform 2300; grid, 7 by 7: exact resistance 160, common neighbours 187, uniform 187; two sparse clusters, one edge: exact resistance 280, common neighbours 423, uniform 423; two sparse clusters, three edges: exact resistance 277, common neighbours 323, uniform 273.10030010003000two cliques of 20, one bridgeexact resistance133common neighbours121uniform95416 cliques of 8 in a rowexact resistance641common neighbours555uniform2300grid, 7 by 7exact resistance160common neighbours187uniform187two sparse clusters, one edgeexact resistance280common neighbours423uniform423two sparse clusters, three edgesexact resistance277common neighbours323uniform273samples for nine draws in ten connected400 draws eacha neighbourhood sees triangles, not cuts
Fig. 6 The samples for nine draws in ten connected, by exact resistance, by common neighbours and uniformly, on graphs with triangles and without.

On two cliques of twenty joined by a bridge, the rule needs 121 samples for nine draws in ten, against exact resistance’s 133 and uniform’s 954, and at 240 samples all four hundred draws are connected. The prediction asked for under one in twelve disconnected. On every chain it beats exact resistance, 1,254 samples against 1,482 at thirty-two cliques, because it gives a bridge weight one and a clique edge of eight one-seventh, a ratio of seven where resistance gives four: it over-weights the bridges, which is the right mistake when connection is the goal. On the grid it is uniform sampling exactly, 187 samples, since no edge of a grid is in a triangle and every edge gets the same weight. That is the “only as badly as uniform” of the prediction, and it is no loss there, since uniform needed only 17 per cent more than exact resistance’s 160. A grid is the graph on which the second eigenvalue sets the rate of everything that spreads across it, and it has no thin cut anywhere for a rule to find.

The rule’s weakness is the grid’s property in a graph that has a cut. Two random graphs of forty vertices, every vertex of degree four, joined by a single edge, have almost no triangles inside either cluster, so the bridge’s local picture, endpoints sharing no neighbour, is the picture of nearly every edge in the graph. Common neighbours needs 423 samples there, exactly uniform’s 423, while exact resistance needs 280. The resistance of an edge inside a sparse cluster is about a half, and a bridge’s is one, so exact resistance still sees a factor of two that no count of triangles can. The rule finds thin cuts in graphs whose clusters are dense, which is the case it was proposed for, and nowhere else. A partition by the Fiedler vector would find this cut, at the price of an eigenvector, and a partition decided in the last digit is the warning about what that price can buy on a graph with a symmetry.

What resistance is for, again

Put the measurements side by side and the earlier essay’s conclusion survives with a sharper edge. On these graphs, the effective resistance’s contribution to keeping a sparsifier connected is to put the right probability on cut edges. For a cut that is a single bridge, two random solves compute that probability exactly, and for a cut inside a dense cluster structure a count of common neighbours over-estimates it, which is better still for connection. Only on graphs whose clusters are themselves sparse does a resistance see something that neither cheap rule does. And the spectral band of the draws that stay connected, which a graph with a tenth of the edges and the earlier essay measured, is not touched by any of this; it is the second job, and on dense clusters uniform sampling does it at least as well.

That is also the case for not computing resistances at all where the structure is known. A linear-time traversal finds every bridge in a graph, and a sparsifier that keeps the bridges deterministically and samples the rest uniformly would need only enough samples to connect each clique, which is the interior cost every rule above pays anyway, with no coupon collected over the bridges at all. A distance computed by a solve introduced the resistance as the one quantity on a graph with no combinatorial route to it. For a cut edge there is a combinatorial route, and the measurement here says it is the only part of the resistance that connection needed.

What a row of cliques cannot show

Every cut here is a bridge, a single edge, and the sketch’s exactness is a theorem about single-edge cuts. A thin cut of two or three edges is not a cut edge by itself, the current divides among its edges, and the projection is not exact on any of them: on the sparse clusters joined by three edges the two-solve sketch gives one of the three cut edges 0.59 of a uniform share, where exact resistance gives 1.23. The chains are regular, every clique the same size and every bridge alike, which is what makes the coupon law exact; a chain whose cliques vary would mix the per-bridge probabilities, and the slowest bridge would set the count. Four hundred draws resolve the 90th percentile to a few per cent, which is enough for every comparison drawn here and not for the second digit of a ratio near one.

Still open: cuts of two edges, and keeping what a traversal finds

A chain of double links. Join each clique to the next by two edges between different vertex pairs. Each link is then a cut of two edges, each with resistance about a half, and neither is a cut by itself. The prediction with a sign is that the two-solve sketch then needs over 1.5 times exact resistance’s samples on 32 cliques of eight, against 1.38 here, because its estimate of a link edge is no longer exact and the slowest of 31 links sets the count; and that common neighbours, which gives a link edge the same weight as a bridge, needs fewer samples than exact resistance by a larger margin than here, since a double link is easier to keep than a bridge and the rule over-weights it by as much.

Keep the bridges, sample the rest. A sparsifier that keeps every bridge found by a traversal and samples the other edges uniformly needs only to connect each clique. The prediction with a sign is that on 32 cliques of eight it connects nine draws in ten at under 1,100 samples, below exact resistance’s 1,482 with no solve at all, and that its spectral band at 2,000 samples is within ten per cent of exact resistance sampling’s, since the second job is done as well by uniform sampling inside dense cliques.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Connected componentsEffective resistanceFoster theoremGraph laplacianImportance samplingRandom projectionSpectral sparsification