combinatorial algorithms reference text: kreher and stinson

15
Combinatorial Algorithms Reference Text: Kreher and Stinson

Upload: randolph-little

Post on 13-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Combinatorial Algorithms Reference Text: Kreher and Stinson

Combinatorial AlgorithmsReference Text:

Kreher and Stinson

Page 2: Combinatorial Algorithms Reference Text: Kreher and Stinson

Combinatorial Algorithms can be generally classified into three types:

1) Generation: Contruct all the combinatorial structures of a given type. Examples of these structures are subsets, permutations, partitions, and trees.

2) Enumeration: Count the number of different structures of a given type. By different we usually mean non-isomorphic. (We can't turn one structure into another by applying a permutation.) All generation algorithms are also enumeration algorithms, since the objects can be counted as they are created. Enumeration is often easier than generation. Example we know the number of k-subsets of n is n!/(n-k)!k! while actually listing them is harder.

3) Search: Find at least one example of a structure of a given type. Optimization is a type of search.

Page 3: Combinatorial Algorithms Reference Text: Kreher and Stinson

Combinatorial Structures

Sets and Lists (Finite Sets) One of basic building blocks Set: Unordered collection of distinct objects List: ordered collection of objects (not necessarily

distinct) Cardinality: |A| = number of elements in set A k-set: set of cardinality k Permutation: an ordering of a set; a list of the

elements of the set, such that every element occurs exactly once.

Page 4: Combinatorial Algorithms Reference Text: Kreher and Stinson

Graphs G = (V, E), where V is a finite set of vertices and E is a finite set

of edges. Each edge is a 2-element subset of vertices.

Incidence (edge with a vertex): edge e = (v1,v2) is incident with vertices v1 and v2.

Degree of a vertex v: deg(v) = number of edges incident with v.

Types of graphs

Complete graph: E contains all 2-element subsets of V. K

n = complete graph on n vertices.

Regular graph of degree d: all vertices have degree d.

Weighted graph: all edges have an associated weight.

Page 5: Combinatorial Algorithms Reference Text: Kreher and Stinson

Representation of Graphs

Adjacency Matrix is a |V|x|V| matrix where A[i][j] = 1 iff there exists an edge between vi and vj. If the graph is weighted then A[i][j] = weight of that edge.

Adjacency List A is a list of |V| items corresponding to the vertices in the graph. Each item A[x] is itself a list, consisting of the vertices incident with vertex x. Often used with sparsely connected graphs to save memory.

Incidence matrix is a |V|x|E| matrix where A[i][j] = 1 iff vertex i is incident with edge j. Each column has two 1’s (indicating vertices incident with each edge. Each row i has deg(i) 1’s.

Page 6: Combinatorial Algorithms Reference Text: Kreher and Stinson

Adjacency Matrix Example (Courtesy of S. Houghten)

5

1

6 73

42

1 2 3 4 5 6 7

1 0 1 1 0 0 1 0

2 1 0 1 1 0 1 1

3 1 1 0 1 1 1 1

4 0 1 1 0 0 0 1

5 0 0 1 0 0 1 1

6 1 1 1 0 1 0 1

7 0 1 1 1 1 1 0

Page 7: Combinatorial Algorithms Reference Text: Kreher and Stinson

Adjacency List Example (Courtesy of S. Houghten)

5

1

6 73

42

[{2,3,6},{3,4,6,7},{4,5,6,7},{7},{6,7},{7}]

v1 v2 v3 v4 v5 v6

In this case, vertices are listed in increasing order to prevent listing the same edge from both ends. For example 1-2 is listed by 2-1 is not.

Page 8: Combinatorial Algorithms Reference Text: Kreher and Stinson

Incidence Matrix Example (Courtesy of S. Houghten)

Edges are listed in increasing order. If 12 is listed then 21 is not.5

1

6 73

42

12 13 16 23 24 26 27 34 35 36 37 47 56 57 67

1 1 1 1

2 1 1 1 1 1

3 1 1 1 1 1 1

4 1 1 1

5 1 1 1

6 1 1 1 1 1

7 1 1 1 1 1

Page 9: Combinatorial Algorithms Reference Text: Kreher and Stinson

Set Systems (X, B), where X is a finite set of points and B is a

finite set of blocks, such that each block is a subset of X.

A graph is just a set system where every block has a cardinality of 2.

Page 10: Combinatorial Algorithms Reference Text: Kreher and Stinson

Binary Error Correcting Codes

A set of M binary vectors (codewords) of length n with minimum distance d.

2 codewords are at distance d (from each other) if they differ in exactly d positions.

Weight is the number of 1-bits in a codeword.

Minimum distance is the the smallest distance between any pair of codewords. (For linear codes, minimum distance = minimum weight).

A code is linear if for any codewords u and v, u+v is also a codeword (“addition” is done mod 2, bitwise). In this case, the code is usually denoted as (n,k,d) where k is the dimension of the code.

Page 11: Combinatorial Algorithms Reference Text: Kreher and Stinson

The dimension of a code is the number of linearly independent vectors that are used to create the code.

The entire set of M=2k vectors can be generated by taking all possible linear combinations of these vectors.

Representation:

A general code is represented by a list of its codewords.

Linear codes can be more compactly represented by a generator matrix (k x n)

The list of all codewords is generated by taking all possible linear combinations of vectors in the generator matrix.

Example (7,4,3) Hamming code.

Page 12: Combinatorial Algorithms Reference Text: Kreher and Stinson

(7,4,3) Hamming Code 1 1 0 1 0 0 0

0 1 1 0 1 0 0

0 0 1 1 0 1 0

0 0 0 1 1 0 10000000

1101000011010000110100001101100011001000111010001

0010111100101111001011110010011100110111000101110

1111111

0

Row 1Row 2Row 3Row 4Rows 1+2+3Rows 2+3+4Rows 1+2+4

Rows 3+4Rows 1+2+3+4Rows 1+4Rows 1+3Rows 2+4Rows 1+2Rows 2+3

Rows 1+3+4

Page 13: Combinatorial Algorithms Reference Text: Kreher and Stinson

The above code can correct up to 1 error in a string of 7 bits. How it works:

All data must be stored as codewords (so we can’t have just any one of the 27 possible strings of 7 bits; it must be one of the 16 chosen codewords).

When we read our received word, if it's the same as one of the codewords, then there probably has not been a transmission error.

Otherwise, there has been an error, so we pick the closest one (guessing that was what it was meant to be).

E.g. read 1111000 guess 1101000 since it’s the only one that differs in just 1 place.

Here, we are assuming that one transmission error is more likely than 2 or more.

Page 14: Combinatorial Algorithms Reference Text: Kreher and Stinson

Combinatorial Generation Algorithms

Page 15: Combinatorial Algorithms Reference Text: Kreher and Stinson

Used to generate combinatorial objects. We will look at: Lexicographic ordering (for all subset and k-

susbsets) on board. Ranking and unranking (on board). Minimum change ordering (Gray Codes)