D1 Flashcards

1
Q

Define Hamiltonian Cycle.

A

A cycle which visits all vertices on a graph.

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

Give an example of a graph which would not have a Hamiltonian Cycle.

A

A tree.

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

Define Tree.

A

A graph which connects all vertices but has no cycles.

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

If there is a graph with n vertices, how many distinct cycles will there be if we assume each vertex is connected to every other one?

A

(n-1)!/2 (As if we have a graph ABCDE then A has 4 options, be has 3 and so on, so 4!. However, this also counts reverse cycles, so we have to half it to get the number of distinct cycles).

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

What is a Eulerian Trail (or cycle)?

A

A graph which covers every edge of the graph exactly once and finishes at the start vertex.

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

What is the condition for a graph to have a Eulerian Trail?

A

The graph’s vertices all must have even order.

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

What is a semi-Eulerian Trail?

A

A path in which you can cover all vertices exactly once, while starting and finishing on different, odd vertices.

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

What is the condition for a graph to have a semi-Eulerian Trail?

A

The graph must have exactly 2 odd vertices, with the rest being even, so the path can start on one odd vertex and finish on the other.

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

Define traversable.

A

A graph is traversable if you can cover all edges on a graph without taking the pen off the paper (this is only possible if the graph is a Eulerian or semi-Eulerian graph).

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

Define isomorphic.

A

2 graphs are isomorphic if they have the same vertices and edges (i.e. Their matrices would be identical).

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

Define digraph.

A

A digraph is one which has arrows to show direction of its edges. It is important if for example an arc could only go from A to B, to name the arc AB not BA.

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

What is the name for a graph that gives weights (numbers) on its arcs?

A

A network or weighted graph.

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

What is a distance matrix and an incidence matrix?

A

A distance matrix is a matrix which denotes the weight of each arc; an incidence matrix defines what is connected to what with no quantities.

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

How to we find the number of edges from a matrix (which is NOT a digraph)

A

We sum up all the values in the matrix and divide them by 2.

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

Define valency.

A

Another word for order, the valency is the number of edges connected to a certain vertex.

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

What sort of algorithm/complexity of the algorithm is bubble sort?

A

Quadratic complexity (or has an order of n^2) due to the maximum number of comparisons being n/2(n-1).

17
Q

Define complete enumeration.

A

Solving a problem by listing all the possible combinations and choosing the best one from that list.

18
Q

Define a heuristic algorithm.

A

An efficient algorithm which will get us a good (if not perfect) result.

19
Q

Give an advantage and disadvantage of a heuristic algorithm.

A

Advantage: can give us a solution from large groups in which it would take far too long to guess.
Disadvantage: it may not always give the optimal solution.

20
Q

Outline briefly the first-fit algorithm.

A

We leave the items in the order given and place them in the first available bin with enough space.

21
Q

Outline briefly the binary first-fit decreasing algorithm.

A

Items are ordered in descending order of size first, then fit into the first available bin with enough space.

22
Q

Outline briefly the full bin-packing algorithm.

A

Judging by eye, we place items into sets which will fully (or very nearly fully) fill a bin, and pack them accordingly.

23
Q

How do we find the middle item in a list?

A

1/2(N+1) if N is odd, and 1/2(N+2) if N is even.