paths and polynomials

Post on 29-Jun-2015

390 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Paths & Polynomials

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

Walks to the rescue…

Walks to the rescue…

Walks to the rescue…

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

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

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

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

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

What is A2[i,j]?

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

What is A2[i,j]?

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

What is A2[i,j]?

i

j

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

What is A2[i,j]?

i

j

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

What is A2[i,j]?

i

j

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

What is A2[i,j]?

i

j

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

What is A2[i,j]?

i

j

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

What is A2[i,j]?

i

j

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

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

What is Ak[i,j]?

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.

We know how to count walks!

We know how to count walks!

Suppose we now want to count paths.

We know how to count walks!

Suppose we now want to count paths.

Let U be the collection of all Hamiltonian Walks.

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.

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

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

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

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.

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

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

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.

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.

Polynomial Identity Testing

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

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

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.

Basic Idea

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

Simplifying is expensive, but evaluating is cheap.

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.

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.

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]

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,

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.

The Trick

Evaluate these polynomials over finite fieldsof characteristic two.

Evaluate these polynomials over finite fieldsof characteristic two.

a + a = 0

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]

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]

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]

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]

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]

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]

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

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)]

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:

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, �)

This polynomial captures exactly the paths in G,

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

W:=v1,...,vk

�(W, �)

W:=v1,...,vk

�(W, �)

How do we evaluate this polynomial now?

W:=v1,...,vk

�(W, �)

How do we evaluate this polynomial now?

Inclusion ExclusionRELOADED

top related