Paths and Polynomials

85
Paths & Polynomials

Transcript of Paths and Polynomials

Page 1: Paths and Polynomials

Paths & Polynomials

Page 2: Paths and Polynomials
Page 3: Paths and Polynomials
Page 4: Paths and Polynomials
Page 5: Paths and Polynomials
Page 6: Paths and Polynomials
Page 7: Paths and Polynomials
Page 8: Paths and Polynomials
Page 9: Paths and Polynomials
Page 10: Paths and Polynomials
Page 11: Paths and Polynomials
Page 12: Paths and Polynomials
Page 13: Paths and Polynomials
Page 14: Paths and Polynomials
Page 15: Paths and Polynomials
Page 16: Paths and Polynomials
Page 17: Paths and Polynomials
Page 18: Paths and Polynomials
Page 19: Paths and Polynomials
Page 20: Paths and Polynomials
Page 21: Paths and Polynomials
Page 22: Paths and Polynomials

Hamiltonian Path has an algorithm thatspends O(2n) time andconsumes O(2n) space.

Page 23: Paths and Polynomials
Page 24: Paths and Polynomials

Walks to the rescue…

Page 25: Paths and Polynomials

Walks to the rescue…

Page 26: Paths and Polynomials

Walks to the rescue…

Page 27: Paths and Polynomials
Page 28: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

Page 29: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

Page 30: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

Page 31: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

Page 32: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

Page 33: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

Page 34: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

i

j

Page 35: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

i

j

Page 36: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

i

j

Page 37: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

i

j

Page 38: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

i

j

Page 39: Paths and Polynomials

Adjacency Matrix A[i,j] = 1 iff (i,j) is an edge in G.

What is A2[i,j]?

i

j

Page 40: Paths and Polynomials

What is A2[i,j] counts the number of common neighbors of i and j.

Page 41: Paths and Polynomials

What is A2[i,j] counts the number of common neighbors of i and j.

What is Ak[i,j]?

Page 42: Paths and Polynomials

What is A2[i,j] counts the number of common neighbors of i and j.

What is Ak[i,j]?

What is Ak[i,j] counts the number of walks of length kbetween i and j.

Page 43: Paths and Polynomials

We know how to count walks!

Page 44: Paths and Polynomials

We know how to count walks!

Suppose we now want to count paths.

Page 45: Paths and Polynomials

We know how to count walks!

Suppose we now want to count paths.

Let U be the collection of all Hamiltonian Walks.

Page 46: Paths and Polynomials

We know how to count walks!

Suppose we now want to count paths.

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Page 47: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X =n�

i=1

Ai

Page 48: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

Page 49: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

Page 50: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

The set of walks that avoid i.

Page 51: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

The set of walks that avoid i.

|X| = |U| ��

Z�[n]

(�1)|Z|�

i�Z

Ai

Page 52: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

The set of walks that avoid i.

|X| = |U| ��

Z�[n]

(�1)|Z|�

i�Z

Ai

Page 53: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

The set of walks that avoid i.

|X| = |U| ��

Z�[n]

(�1)|Z|�

i�Z

Ai

The set of walks that avoid X.

Page 54: Paths and Polynomials

Let Ai be the set of walks of length n passing through i.

Let U be the collection of all Hamiltonian Walks.

Consider…

X = U �n�

i=1

Ai

The set of walks that avoid i.

|X| = |U| ��

Z�[n]

(�1)|Z|�

i�Z

Ai

The set of walks that avoid X.

Page 55: Paths and Polynomials

Polynomial Identity Testing

Input: A polynomial p(x). Question: Is p(x) identically zero?

(x1 + 3x2 � x3)(3x1 + x4 � 1) · · · (x7 � x2) � 0?

Page 56: Paths and Polynomials

Polynomial Identity Testing

Input: A polynomial p(x). Question: Is p(x) identically zero?

(x1 + 3x2 � x3)(3x1 + x4 � 1) · · · (x7 � x2) � 0?

Captures several problems, like checking if two polynomialsare equal, finding a perfect matching, primality testing,

and so on.

Page 57: Paths and Polynomials

Basic Idea

(x1 + 3x2 � x3)(3x1 + x4 � 1) · · · (x7 � x2) � 0?

Simplifying is expensive, but evaluating is cheap.

Page 58: Paths and Polynomials

Basic Idea

(x1 + 3x2 � x3)(3x1 + x4 � 1) · · · (x7 � x2) � 0?

Simplifying is expensive, but evaluating is cheap.

The probability that a random assignmentcorresponds to a root is low.

Page 59: Paths and Polynomials

Given a (directed) graph G and a number k… !!!

Let’s try to construct a polynomial that is zero !

if and only if !

G has a path of length k.

Page 60: Paths and Polynomials
Page 61: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

Page 62: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

We want terms corresponding to walks to cancel out,

Page 63: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

We want terms corresponding to walks to cancel out,

somehow.

Page 64: Paths and Polynomials

The Trick

Page 65: Paths and Polynomials
Page 66: Paths and Polynomials

Evaluate these polynomials over finite fieldsof characteristic two.

Page 67: Paths and Polynomials

Evaluate these polynomials over finite fieldsof characteristic two.

a + a = 0

Page 68: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

Page 69: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Page 70: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Page 71: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Page 72: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Page 73: Paths and Polynomials

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Edges

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Vertices

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1]y[v2] · · · y[vk]

Page 74: Paths and Polynomials
Page 75: Paths and Polynomials

For a walk W, we will dump all these terms into the formula:

Page 76: Paths and Polynomials

For a walk W, we will dump all these terms into the formula:

�:[k]�[k]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1, �(1)]y[v2, �(2)] · · · y[vk, �(k)]

Page 77: Paths and Polynomials

For a walk W, we will dump all these terms into the formula:

�:[k]�[k]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1, �(1)]y[v2, �(2)] · · · y[vk, �(k)]

Sum this over all walks W:

Page 78: Paths and Polynomials

For a walk W, we will dump all these terms into the formula:

�:[k]�[k]

x[v1,2]x[v2,3] · · · x[vk�1,k]y[v1, �(1)]y[v2, �(2)] · · · y[vk, �(k)]

Sum this over all walks W:

W:=v1,...,vk

�(W, �)

Page 79: Paths and Polynomials
Page 80: Paths and Polynomials

This polynomial captures exactly the paths in G,

i.e, it is identically zero precisely when G has no paths of length k.

Page 81: Paths and Polynomials

W:=v1,...,vk

�(W, �)

Page 82: Paths and Polynomials

W:=v1,...,vk

�(W, �)

How do we evaluate this polynomial now?

Page 83: Paths and Polynomials

W:=v1,...,vk

�(W, �)

How do we evaluate this polynomial now?

Page 84: Paths and Polynomials
Page 85: Paths and Polynomials

Inclusion ExclusionRELOADED