Algorithms for Graphs - Week 7

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

24 Terms

1
New cards

What is a walk?

A sequence of vertices (𝑣0, 𝑣1, … , 𝑣k
such that (𝑣i, 𝑣i+k) ∈ 𝐸. The length of the walk is k (the number of edges used).

2
New cards

How is a path different from a walk?

Forbids us returning to the same vertex again, (all vertices are distinct), so the edges and vertices are all different from one another.

3
New cards

What is a complete graph?

Where there is an edge between all pairs of vertices.

4
New cards

For n vertices, how many edges are there in a complete graph?

n(n-1)/2

5
New cards

How many walks are there for a sequence of vertices starting at u and ending at v?

Infinite

6
New cards

How many walks are there for a sequence of vertices starting at u, ending at v with length k+1?

Walks of length k: so nk-1 number of walks

7
New cards

How many numbers of paths are there?

(n-2)!/(n-k-1)!

8
New cards

What do:

sp(𝑢, 𝑣) and l(sp(𝑢, 𝑣)) represent?

sp(𝑢, 𝑣) → The shortest path between u and v

l(sp(𝑢, 𝑣)) → The length of the path

9
New cards

If 𝑤 ∈ sp(𝑢, 𝑣) then what is sp(𝑢, 𝑣) equivalent to?

𝑠𝑝(𝑢, 𝑤) + 𝑠𝑝(𝑤, 𝑣)

10
New cards

What is the algorithm for Dijkstras?

knowt flashcard image
11
New cards
<p>Perform Dijkstra’s on this graph:</p>

Perform Dijkstra’s on this graph:

knowt flashcard image
12
New cards

What is the difference between the A* algorithm and Dijkstras?

Uses the sum of the actual value and the heuristic value.

13
New cards
<p>Perform the A* algorithm on this graph (given the red values are the heuristic values)</p>

Perform the A* algorithm on this graph (given the red values are the heuristic values)

knowt flashcard image
14
New cards

What is a spanning tree?

Is a tree which includes all vertices and uses only the minimum number of edges in the graph. All connected graphs have at least one spanning tree.

15
New cards

How many edges are in a spanning tree, given the number of vertices is n?

n-1

16
New cards

What is the minimum spanning tree?

The tree with the smallest weight

17
New cards

What is the pseudocode for the minimum spanning tree (Prim’s algorithm).

knowt flashcard image
18
New cards

What is a greedy algorithm?

A problem-solving approach that makes the locally optimal choice at each step, hoping to find the global optimum, without considering the long-term implications of those choices

19
New cards

What is the complexity of Prim’s algorithm?

O(n3) as there are potentially O(n2) edges.

20
New cards

What is an intractable problem?

A problem where the best algorithm is Ω(nc)∀c is super-polynomial in complexity

21
New cards

What is a tractable problem?

A problem where there is an algorithm that takes polynomial time O(nc) time for constant c

22
New cards

What is a Hamiltonian path?

A path in the graph which visits all vertices exactly once.

23
New cards

Why is a Hamiltonian path intractable?

The best-known algorithms are Ω nc ∀c, i.e. there is no polynomial time algorithm.

24
New cards

What is the travelling salesman problem (TSP)?

a travelling salesman must visit a set of cities and return to the start, while minimising the distance travelled. This problem can be represented on a graph – the cities are the vertices, and the edge weights represent travelling distances between cities. The problem is then to find a closed path (called a cycle) with minimum cost.
This is another NP-hard problem with all known
solutions having super-polynomial complexity.