Packing the edges of a bipartite multigraph into packets #
Lemma D.3 of [OAI26k] (§D.4.2, pp. 58–59) labels the vertices on each side of a bipartite
multigraph by words in [r]^a and places its M edges into packets of L = 2 ^ a slots.
Edge e joins the row vertex rowOf e to the column vertex colOf e. A Packing records
- the row and column labels;
- for each edge its packet and slot, with no two edges in the same slot of the same packet
(
Packing.injective), so an edge occupies the same slot at its row and column ends and an unused slot has no ports; - for each packet and coordinate
ia pair of symbols(σ, τ): an edge whose slot has binary digitiequal to0has row symbolσand column symbolτin coordinatei, and one whose digit is1has them the other way round (Packing.labels_eq). So the unordered pair of symbols is fixed in each packet and coordinate, and when the two symbols differ, digitiof the slot gives their orientation.
These are the structural properties (1)–(2) of Lemma D.3. The construction packing meets the
quantitative ones under the size hypotheses (D.6), 2 Δ D² ≤ M and L D ≤ M with D = r ^ (2a)
the number of pairs of labels and Δ the maximum degree:
- (1) there are at most
3M / Lpackets (numPackets_packing_mul_le); - (3) in every coordinate, the vertices with a given symbol have at most
2M / rports on each side (row_ports_packing_le,col_ports_packing_le), which is within the3M / rof the source.
Labels. rowLabels and colLabels fix one whole label at a time by the method of conditional
expectations, minimizing the closed-form average partialIncidencePotential of the potential
Φ = ∑_γ (X_γ - M / D)², where X_γ counts the edges with the pair of labels γ
(Cslib.BalancedSchedules.greedyLabelPassBy). Ties go to the first candidate in radix order
(labelCandidates), the order in which a machine streams the candidates by counting. For
independent uniform labels, 𝔼 Φ ≤ 2 M Δ (Cslib.BalancedSchedules.expect_incidence_potential_le),
so the chosen labels have Φ ≤ 2 M Δ (potential_labels_le), and with 2 Δ D² ≤ M every class
has at most 2M / D edges (occupancy_labels_mul_le).
Packets. Packing.ofLabels packs the edges for any labels. Number the edges with each pair
of labels γ from zero in the order of E (classIndex), and pad each class to h L slots,
the largest class size rounded up to a multiple of L (numBlocks). An edge with number
k = b L + o goes to block b. In a coordinate where its two symbols differ, its slot digit is
their orientation; where they agree, it is the corresponding digit of o. Its packet is
determined by the block, the unordered pairs of symbols, and the digits of o in the
coordinates where the symbols differ. So each packet holds 2 ^ (a - a') slots of each of the
2 ^ a' orientations of its pairs, as in the source, and there are h D packets.
The source's padded size H_pad is our h L. All constructions are executable finite
computations with mathematical correctness proofs. A native polynomial-time computation of
packing is in CslibFrontier/Computability/PolyTime/PacketPacking.lean.
Main definitions #
Cslib.PacketPacking.Packing: labels and an injective placement of the edges into slots of packets with the orientation property.Cslib.PacketPacking.pairLabel,Cslib.PacketPacking.classIndex,Cslib.PacketPacking.numBlocks: the pair of labels of an edge, its number within its class, and the number of blocks.Cslib.PacketPacking.Packing.ofLabels: the packing for given labels.Cslib.PacketPacking.labelCandidates: the candidate labels, in radix order.Cslib.PacketPacking.rowLabels,Cslib.PacketPacking.colLabels: the labels chosen by conditional expectations.Cslib.PacketPacking.packing: the packing of Lemma D.3.
Main results #
Cslib.PacketPacking.classIndex_lt_occupancy,Cslib.PacketPacking.classIndex_injective: edges in a class are numbered injectively below the class size.Cslib.PacketPacking.Packing.numPackets_ofLabels_mul_le,Cslib.PacketPacking.Packing.row_ports_ofLabels_le,Cslib.PacketPacking.Packing.col_ports_ofLabels_le: the packet and port bounds from a bound on the class sizes.Cslib.PacketPacking.potential_labels_le,Cslib.PacketPacking.occupancy_labels_mul_le: the collision potential and class sizes of the chosen labels.Cslib.PacketPacking.numPackets_packing_mul_le,Cslib.PacketPacking.row_ports_packing_le,Cslib.PacketPacking.col_ports_packing_le: Lemma D.3 (1) and (3).Cslib.PacketPacking.exists_packing: Lemma D.3 as an existence statement.
References #
- [OAI26k], Appendix D.4.2, Lemma D.3 and its proof, pp. 58–59, under (D.6), p. 58.
Packings #
A packing of the edges of a bipartite multigraph into packets of 2 ^ a slots, where edge
e joins the row vertex rowOf e to the column vertex colOf e. It labels the vertices on
each side by words in [r]^a, places each edge in a slot of a packet with no two edges in the
same place, and gives each packet a pair of symbols in each coordinate. An edge whose slot has
binary digit i equal to 0 has the packet's pair as its row and column symbols in coordinate
i; one whose digit i is 1 has the pair swapped.
The label of a row vertex.
The label of a column vertex.
- numPackets : ℕ
The number of packets.
- packet : E → Fin self.numPackets
The packet of an edge.
The slot of an edge in its packet.
The pair of symbols of a packet in each coordinate, oriented as at slot
0.No two edges occupy the same slot of the same packet.
- labels_eq (e : E) (i : Fin a) : (self.rowLabel (rowOf e) i, self.colLabel (colOf e) i) = if (↑(self.slot e)).testBit ↑i = true then (self.symbols (self.packet e) i).swap else self.symbols (self.packet e) i
Digit
iof the slot orients the packet's pair of symbols in coordinatei.
Numbering the edges within their classes #
The largest class size: one more than the largest number of an edge in its class, or zero without edges.
An edge is numbered below the size of its class.
Distinct edges in the same class have distinct numbers.
A bound B on the class sizes, in the form X_γ D ≤ B, bounds the largest class.
The packing for given labels #
The digits of the slot of an edge. Where its row and column symbols differ, digit i is 1
when the row symbol is the larger; where they agree, it is digit i of the number of the edge in
its class.
The packet data of an edge: its block, and in each coordinate its sorted pair of symbols,
swapped when digit i of its number in its class is 1. This determines the unordered pairs of
symbols and, where they differ, digit i of the number.
Lemma D.3 (1) from class sizes. If every class has at most 2M / D edges and
L D ≤ M, then there are at most 3M / L packets.
From a bound on the class sizes, each symbol in each coordinate labels the row ends of at most
2M / r edges.
From a bound on the class sizes, each symbol in each coordinate labels the column ends of at
most 2M / r edges.
Labels by conditional expectations #
The candidate labels in radix order: the word numbered j < r ^ a has as its digit i the
digit i of j in base r, least significant first (finFunctionFinEquiv). A machine streams
them by counting j.
Every label is a candidate.
The partial labels after the conditional-expectation pass: every row vertex, then every column
vertex, receives the first candidate label minimizing the conditional expectation of the collision
potential of the pairs of labels, partialIncidencePotential. (In the convention of
Cslib.BalancedSchedules, rows are the variables and columns the factors.)
The row labels chosen by conditional expectations.
The column labels chosen by conditional expectations.
The collision potential of the chosen labels. If every vertex has degree at most Δ, the
potential Φ = ∑_γ (X_γ - M / D)² of the pairs of labels is at most 2 M Δ, a bound on its
average for independent uniform labels.
Class sizes of the chosen labels. Under the size hypothesis 2 Δ D² ≤ M of (D.6), where
D = r ^ (2a) is the number of pairs of labels, every class has at most 2M / D edges.
Lemma D.3 #
The packing of Lemma D.3: the packing for the labels chosen by conditional expectations.
Lemma D.3 (1). Under (D.6), 2 Δ D² ≤ M and L D ≤ M, there are at most 3M / L
packets.
Lemma D.3 (3), rows. Under (D.6), in every coordinate the row vertices with a given symbol
have at most 2M / r ports.
Lemma D.3 (3), columns. Under (D.6), in every coordinate the column vertices with a given
symbol have at most 2M / r ports.
Lemma D.3 (packing into packets). Let a bipartite multigraph have M edges, joining row
vertices to column vertices, and maximum degree at most Δ, and let D = r ^ (2a) and
L = 2 ^ a satisfy (D.6): 2 Δ D² ≤ M and L D ≤ M. Then there is a packing of its edges into
at most 3M / L packets of L slots, oriented as in Packing, such that in every coordinate the
vertices with a given symbol have at most 3M / r ports on each side. packing constructs it.