certifying algorithms algorithms and networks. certifying algorithms what is it? examples: –euler...

25
Certifying algorithms Algorithms and Networks

Upload: lee-onion

Post on 01-Apr-2015

264 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms

Algorithms and Networks

Page 2: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms2

Certifying algorithms

• What is it?• Examples:

– Euler tour– Bipartite graphs– Flow– Planarity

Page 3: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms3

Certifying algorithms

• Type of algorithm design, introduced by Mehlhorn and others

• No formal definition here

Page 4: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms4

Correctness of programs

• Program:– Input– (Working of program): Hidden to user– Output

• But ... how do we know there is no bug? Why is the program correct?

Page 5: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms5

Example

• Euler tour algorithm• Input: Graph G=(V,E)• Output:

– An Euler tour if it exists– “NO”, if there is no Euler tour

Page 6: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms6

Example

• Euler tour algorithm• Input: Graph G=(V,E)• Output:

– An Euler tour if it exists• This, we can check!

– “NO”, if there is no Euler tour• But how do we know if this answer is correct?

Page 7: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms7

Certifying algorithm

• Program– Input– (Working of program): still hidden to user– Output + proof (certificate) that output is

correct!

• Plus: easy way to check these proofs

Page 8: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms8

Euler tour

• Certificate for Euler tour program• YES: the Euler tour itseld• NO: …

Page 9: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms9

Euler theorem

• A graph G=(V,E) has an Euler tour, if and only if the following two conditions hold:– Every vertex has even degree– G is connected

Page 10: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms10

No-Certificate for Euler tour

• A vertex of odd degree• Or• A set of vertices W that forms a connected

component– Verify: W has less than n vertices, and all

neighbors of all vertices in W belong to W

Page 11: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms11

Bipartite graphs

• A graph G=(V,E) is bipartite if we can partition V into sets X and Y such that each edge in E has one endpoint in X and one endpoint in Y

• So … what would be a certificate for Bipartiteness?

Page 12: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms12

Bipartite certificate

• Yes: bipartition• No: odd cycle in G

Page 13: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms13

Algorithm

• Make a depth first search spanning forest of G

• Color the vertices on odd levels red and on even levels blue

• Is there an edge between two vertices of the same color? Then: take the path between these in the tree, and add the edge: odd cycle

Page 14: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms14

Flow

• Input: flow network (G, s, t, c)• Output: maximum flow f

• So, what is a certificate?

Page 15: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms15

Certificate for flow

• Pair:– The flow function f– And, the corresponding maximum cut

• See (the proof of) the max flow min cut theorem

Page 16: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms16

Bipartite Matching

• Input: Bipartite graph G=(V U W,E)• Output: A maximum matching in G

• What is a certificate for the matching?

Page 17: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms17

Certificate for bipartite matching

• Look at the flow model from bipartite matching, and a minimum cut. You get:

• A vertex cover C with the property that |C|=|M|– I.e., each edge has one endpoint in C

• Details on the board

Page 18: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms18

Planarity

• Planar graphs: can be drawn on the plane without crossing edges

• Many applications!• Complicated linear time algorithms for

checking planarity– Tarjan, 1976: linear time for checking planarity– Chiba et al, 1985: linear time algorithm that

finds a planar embedding

Page 19: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms19

Kuratowski

Theorem (Kuratowski) A graph is planar, if and only if it does not contain a subgraph that is a subdivision of K5 or K3,3

Page 20: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms20

Subdivision

• Add vertices on edges

Page 21: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms21

Wagner

Theorem (Wagner) A graph is planar, if and only if it does not contain K5 or K3,3 as a minor

Page 22: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms22

Certificate for nonplanarity

• Hundack et al. 1987: linear time algorithm that finds a a subgraph that is a subdivision of K5 or K3,3 of a nonplanar graph

Page 23: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms23

Certificate for planarity

• Schnyder 1990: – Finds in O(n) time an embedding of a graph in

the plane, such that• Each vertex has integer coordinates between

1 and n – 2 • Each edge is a straight line

• One can easily verify that such an embedding is indeed correct.

Page 24: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms24

Certifying algorithm for planarity

• Either output Schnyder embedding OR• Output minor

Page 25: Certifying algorithms Algorithms and Networks. Certifying algorithms What is it? Examples: –Euler tour –Bipartite graphs –Flow –Planarity Certifying algorithms2

Certifying algorithms25

Conclusions

• Certifying algorithms• Useful for reliability of software• Some examples …• Implemented in some packages nowadays,

e.g., LEDA