24
1 FKT Algorithm by PlusOne Counting perfect matchings in planar graphs With the FKT algorithm

Counting perfect matchings in planar graphs

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Counting perfect matchings in planar graphs

1FKT Algorithm by PlusOne

Counting perfect matchings in planar graphsWith the FKT algorithm

Page 2: Counting perfect matchings in planar graphs

Perfect Matching

2

Z

FKT Algorithm by PlusOne

Given a graph G = (V,E), a matching M in G is a set of pairwise non-adjacent edges. M is said to be perfect if every vertex of G is included in M.

Def

Page 3: Counting perfect matchings in planar graphs

3FKT Algorithm by PlusOne

1 2

3

4

56

7

8

Def Cycle Cover

Page 4: Counting perfect matchings in planar graphs

4FKT Algorithm by PlusOne

A set of disjoint cycles in G that contain all vertices of G.

1 2

3

4

56

7

8

Def Cycle Cover

Page 5: Counting perfect matchings in planar graphs

5FKT Algorithm by PlusOne

A cycle cover that satisfies…• All cycles have even number of vertices.• Every cycle has a direction (clockwise or counter-clockwise).

1 2

3

4

56

7

Non-even Directed Cycle Cover

1 2

3

4

56

7

8

Even Directed Cycle Cover

DefEven Directed Cycle Cover (EDCC)

Page 6: Counting perfect matchings in planar graphs

6FKT Algorithm by PlusOne

M1

1 2

3

4

56

7

81 2

3

4

56

7

8

M2

ObsEvery ordered pair of perfect matchings can be uniquely mapped to an EDCC.

<M1, M2>

1 2

3

4

56

7

8

Page 7: Counting perfect matchings in planar graphs

7FKT Algorithm by PlusOne

ObsEvery ordered pair of perfect matchings can be uniquely mapped to an EDCC.

It’s easy to see that every EDCC can also be decomposed into an ordered pair of perfect matchings.

<M1, M2>

1 2

3

4

56

7

8

Page 8: Counting perfect matchings in planar graphs

Counting Perfect Matchings

8FKT Algorithm by PlusOne

|𝑃𝑀|2 = |𝐸𝐷𝐶𝐶|

The number of perfect matchings

The number of even directed cycle

covers

So counting perfect matchings can be converted into counting EDCCs.

Page 9: Counting perfect matchings in planar graphs

9FKT Algorithm by PlusOne

𝒊 1 2 3 4 5 6 7 8

𝜋(𝑖) 6 3 4 5 2 7 8 1

Recall Discrete Mathematics II and Linear Algebra.

Tip Permutations

The parity of a permutation = the parity of # swaps from the original sequence

sgn(𝜋): sign of a permutation +1 (𝑒𝑣𝑒𝑛 𝑝𝑒𝑟𝑚𝑢𝑡𝑎𝑡𝑖𝑜𝑛)−1 (𝑜𝑑𝑑 𝑝𝑒𝑟𝑚𝑢𝑡𝑎𝑡𝑖𝑜𝑛)

Page 10: Counting perfect matchings in planar graphs

10FKT Algorithm by PlusOne

A: adjacency matrix 𝐴𝑖𝑗 =

+1 (if edge i → j)−1 (if edge j → i)

0 (if no edge between i, j)

sgn(𝜋): sign of a permutation +1 (偶排列)

−1 (奇排列)val 𝜋 ∶ 𝐴𝑖,𝜋(𝑖)

Def Determinant of Oriented GraphIs the determinant of the adjacency matrix!

𝐷𝑒𝑡 𝐴 = 𝜋𝑆𝑔𝑛 𝜋 ∙ 𝑉𝑎𝑙(𝜋)

By definition,

Page 11: Counting perfect matchings in planar graphs

11FKT Algorithm by PlusOne

1 2

3

4

56

7

8

𝒊 1 2 3 4 5 6 7 8

𝜋(𝑖) 6 3 4 5 2 7 8 1

ObsEvery Directed Cycle Cover (DCC) corresponds to a permutation.

𝑖, 𝜋 𝑖 ↔ 𝑒𝑑𝑔𝑒 < 𝑖, 𝜋 𝑖 >

Page 12: Counting perfect matchings in planar graphs

12FKT Algorithm by PlusOne

1 2

3

4

56

7

8

𝒊 1 2 3 4 5 6 7 8

𝜋(𝑖) 6 3 4 5 2 7 8 1

ObsFor a permutation 𝜋, if ∀ 𝑖, 𝜋 𝑖 ∈ 𝐸, we can map 𝜋 to a DCC.

𝑖, 𝜋 𝑖 ↔ 𝑒𝑑𝑔𝑒 < 𝑖, 𝜋 𝑖 >

1 2

3

4

56

7

8

𝒊 1 2 3 4 5 6 7 8

𝜋(𝑖) 7 3 4 5 2 1 8 6

Page 13: Counting perfect matchings in planar graphs

13FKT Algorithm by PlusOne

ObsFor a permutation 𝜋, if ∀ 𝑖, 𝜋 𝑖 ∈ 𝐸, we can map 𝜋 to a DCC.

𝑖, 𝜋 𝑖 ↔ 𝑒𝑑𝑔𝑒 < 𝑖, 𝜋 𝑖 >

The inverse proposition : for a permutation 𝜋 , if it cannot be mapped to a DCC, then ∃ 𝑖, 𝜋 𝑖 ∉ 𝐸.

⇒ 𝐴𝑖,𝜋 𝑖 = 0

⇒ val 𝜋 = 0

Det A =

𝜋

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋) =

𝐷𝐶𝐶

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋)

Page 14: Counting perfect matchings in planar graphs

Non-even DCCs will be cancelled out.

14FKT Algorithm by PlusOne

You can always find another DCC with an opposite direction for the odd cycle.

𝜋

𝜋′

𝑠𝑔𝑛 𝜋 = 𝑠𝑔𝑛(𝜋′)

Remember that 𝐴𝑖𝑗 = −𝐴𝑗𝑖

So 𝑉𝑎𝑙 𝜋 = −1 𝑘 ∙ 𝑉𝑎𝑙 𝜋′

(k is the number of edges in the cycle)

Therefore: 𝑠𝑔𝑛 𝜋 𝑣𝑎𝑙 𝜋 + 𝑠𝑔𝑛 𝜋 𝑣𝑎𝑙 𝜋′ = 0

Obs

Page 15: Counting perfect matchings in planar graphs

Only EDCCs contribute to Det(A)

15FKT Algorithm by PlusOne

Det A

=

𝜋

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋)

Our goal: Find an orientation that makes all 𝑠𝑔𝑛 𝜋 𝑣𝑎𝑙 𝜋 = 1(then 𝑃𝑀2 = 𝐸𝐷𝐶𝐶 = 𝐷𝑒𝑡(𝐴))

Permutations that are not DCC, val(𝜋)=0

This depends on the orientation!

≤ |𝐸𝐷𝐶𝐶|This is equal when all

𝑠𝑔𝑛(𝜋)𝑣𝑎𝑙(𝜋)=1

=

𝐷𝐶𝐶

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋)

=

𝐸𝐷𝐶𝐶

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋) +

𝑁𝑜𝑡 𝑒𝑣𝑒𝑛 𝐷𝐶𝐶

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋)

=

𝐸𝐷𝐶𝐶

𝑆𝑔𝑛 𝜋 𝑉𝑎𝑙(𝜋)

Page 16: Counting perfect matchings in planar graphs

16FKT Algorithm by PlusOne

Alg FKT Algorithm: Finding an Orientation

Planar Graph: a graph that can be drawn in the 2D plane so that its edges intersect only at its vertices.

Not Planar Planar

Page 17: Counting perfect matchings in planar graphs

FKT Algorithm by PlusOne

Alg FKT Algorithm: Finding an Orientation

Planar Graph: a graph that can be drawn in the 2D plane so that its edges intersect only at its vertices.

Face: a planar graph can be seen as a mesh of faces.

Face!

Page 18: Counting perfect matchings in planar graphs

1. Find a spanning tree for G.Call this tree T1.

18FKT Algorithm by PlusOne

Alg FKT Algorithm: Finding an Orientation

Page 19: Counting perfect matchings in planar graphs

1. Find a spanning tree for G.Call this tree T1.

2. Orient the edges arbitrarily.

3. Construct a second tree T2, whose vertices are the faces of T1.Put an edge between faces that share an edge that is not in T1.4. Starting with the leaves of T2, orient these edges of G such that each face has an odd number of edges oriented clockwise. 19FKT Algorithm by PlusOne

Alg FKT Algorithm: Finding an Orientation

Page 20: Counting perfect matchings in planar graphs

20FKT Algorithm by PlusOne

Euler’s Formula

For any cycle C, e = v + f − 1, where e is the number of edges inside C, v is the number of vertices inside C, and f is the number of faces inside C.

𝑣 = 4

𝑓 = 5

Lemma

If all faces have an odd number of clockwise edges then all cycles in an EDCC are oddly oriented.

Cycle 𝐶, 𝑒 = 8.

𝑘𝑖: the number of clockwise lines on the boundary of face.

𝑘: the number of clockwise lines on Cycle (C).

Page 21: Counting perfect matchings in planar graphs

Proof• Let 𝐶 be a nice cycle, let 𝑐𝑖 be the number of clockwise lines on

the boundary of face i in 𝐶, and 𝑐 be the number of clockwise lines on 𝐶.

• We oriented each face to have an odd number of clockwise lines,

so 𝑐𝑖 ≡ 1𝑚𝑜𝑑 2, so 𝑓 ≡ 𝑖=1𝑓

𝑐𝑖 𝑚𝑜𝑑 2.

• But also 𝑖=1𝑓

𝑐𝑖 = 𝑐 + 𝑒 (each interior line is counted as clockwise once).

• So 𝑓 ≡ 𝑐 + (𝑣 + 𝑓 − 1) 𝑚𝑜𝑑 2, so 𝑐 ≡ (𝑣 − 1) 𝑚𝑜𝑑2.

• But 𝑣 ≡ 0 𝑚𝑜𝑑 2 ,as C is a nice cycle.

• So 𝐶, and hence every nice cycle, is oddly oriented.

21FKT Algorithm by PlusOne

Euler’s Formula

For any cycle C, e = v + f − 1, where e is the number of edges inside C, v is the number of vertices inside C, and f is the number of faces inside C.

Page 22: Counting perfect matchings in planar graphs

1 2

3

4

56

7

8

= ((−1) × (−1))𝑘

= 1

22FKT Algorithm by PlusOne

𝑠𝑔𝑛 𝜋 𝑣𝑎𝑙 𝜋

Lemma

If all cycles in an EDCC are oddly oriented then 𝑠𝑔𝑛 𝜋 𝑣𝑎𝑙 𝜋 = 1 for all corresponding 𝜋.

Even cycle

sgn(𝜋): sign of a permutation +1 (偶排列)

−1 (奇排列)

val 𝜋 ∶ 𝐴𝑖,𝜋(𝑖)

= 𝑠𝑔𝑛 𝐶𝑖 ∙ 𝑣𝑎𝑙 𝐶𝑖

= 𝑠𝑔𝑛 𝐶𝑖 𝑣𝑎𝑙(𝐶𝑖)

C1 C2

C3

Oddly oriented

Page 23: Counting perfect matchings in planar graphs

The FKT algorithms finds a feasible orientation!

FKT Algorithm by PlusOne 23

Lemma

If all cycles in an EDCC are oddly oriented then 𝑠𝑔𝑛 𝜋 𝑣𝑎𝑙 𝜋 = 1 for all corresponding 𝜋.

LemmaIf all faces have an odd number of clockwise edges then all cycles in an EDCC are oddly oriented.

Det (A) = |EDCC|

FKT algorithm

Page 24: Counting perfect matchings in planar graphs

FKT Algorithm by PlusOne 24

Graph GRun FKT to find

orientation GCompute det 𝐴 PM = det(𝐴)

How to count perfect matchings?