Combinatorial Optimisation Flashcards

1
Q

We say that two vertices x and y are adjacent if

A

There is an edge connecting x and y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The degree of a vertex x is

A

the number of vertices adjacent to x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Handshaking lemma:

A

sum(deg(x)) = 2 |E|

^ |E| is the number of edges, I think

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Adjacency matrix

A

A matrix with an entry 1 if x and y are adjacent and 0 otherwise.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Adjacency list

A

For each vertex i we keep an ordered list of its neighbours

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The number of steps taken to check if two vertices are adjacent for a:

  • adjacency matrix
  • adjacency list
A
  • matrix: n^2
  • list: 2m

(n is number of vertices; m is number of edges)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

We prefer an adjacency matrix when…

A

The graph is dense

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If there is not a path between two vertices then we say that the distance between them is…

A

…infinite.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In order to find the connected components of a tree we use…

A

a breadth-first search.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A property of BFS trees

A

If xy is an edge of G not belonging to the BFS tree then either x and y are in consecutive layers or in the same layer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Breadth-First Search

A

Start at some point s. Then define each layer L[i] as the set of vertices adjacent to some vertex in L[i-1] that are not already in the BFS tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Theorem: a graph is bipartite if and only if

A

it contains no odd cycle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Algorithm for testing bipartiteness

A

Run BFS.
Let R be the union of odd layers and B be the union of even layers.
If there are no edges connecting two red vertices or two blue vertices, the graph is bipartite.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A greedy algorithm

A

is one which makes locally optimal choices in the hope of finding a globally optimal choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Prim’s algorithm for finding an MST

A

Pick a vertex to start with s, and make s an element of T.
Of all the edges that connect T to vertices not in T, pick the one with the lowest weight.
Output T.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Kruskal’s algorithm for finding an MST

A
  • Order edges in decreasing weight

- Add the lowest weight to the tree, if doing so does not produce a cycle

17
Q

Cut property

A

Cut the network into two sections A and B. If e is the edge with minimum weight connecting A and B, then it must be part of the MSTs.

18
Q

How to deal with weights when some might be the same?

A

Add very small perturbations to them in order to choose between them.

19
Q

Interval scheduling

A

Always choose the event that finishes first, and remove all events incompatible with that event.

20
Q

Conceptualising interval scheduling as a network probem

A

Make a graph having two vertices adjacent if the events overlap; then find the largest set of vertices that are mutually non-adjacent.

21
Q

Interval scheduling: minimising required resources

A

The minimum number of resources required is equal to the maximum number of overlapping tasks.

22
Q

We say that an algorithm is of O(g(n)) if

A

…f(n)

23
Q

Worst-time complexity

A

The maximum number of operations on inputs of size n

24
Q

Master Theorem: given the recurrence

T(n)

A
T(n) = O(n) if q = 1
T(n) = O(nlogn) if q = 2
T(n) = O(n^logq) if q > 2
25
Q

Karatsuba’s integer multiplication: set up

A

write x as x = x[1] * 2 ^ n/2 + x[0].

26
Q

Karatsuba’s algorithm: trick

A

Work out:

  • x[0]*y[0]
  • x[1] * y[1]
  • (x[1] + x[0]) * (y[1] + y[0])