Chapter 9 (Graph algorithms) Flashcards

1
Q

If a graph is not biconnected, the vertices whose removal would disconnect the graph are called ____

A

Articulation points

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

What is the running time of a topological sort?

A

O(|V|^2)

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

What is a DAG?

A

Directed acyclic graph

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

T/F Any connected graph, all of whose vertices have even degree, must have an Euler circuit

A

T

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

What is the main difference between Prim’s and Dijkstra’s algorithms?

A

The update rule

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

Max flow = ____

A

Min cut

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

T/F Prim’s algorithm is a greedy algorithm

A

T

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

When is a connected undirected graph considered to be biconnected?

A

When there is no vertex whose removal would disconnect the graph

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

Explain Prim’s algorithm

A

Choose any vertex, then choose the edge with the lowest cost from this vertex and add it to the tree. We then choose the least edge between vertices in the tree and those not in the tree and add it.

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

When is a directed graph considered weakly connected?

A

Its undirected representation is connected

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

What is a Euler Path?

A

Visits each edge exactly once

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

What is a graph with no cycles called?

A

Acyclic

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

How can you keep track of each vertex as it is visited in an unweighted shortest path problem?

A

Table

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

If a graph is acyclic, how can Dijkstra’s algorithm be improved?

A

Choosing vertices in topological order

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

T/F Dijkstra’s algorithm works with negative edges

A

F

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

In a maximum flow problem, what does Gr tell you?

A

How much more flow an edge can handle

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

T/F Prim’s and Dijkstra’s algorithm have the same running time

A

T

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

When is a directed graph considered strongly connected?

A

Path between all vertices

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

T/F A graph cannot be represented as a 2D array

A

F, it can

20
Q

If a graph is sparse, what is a better solution?

A

Adjacency list

21
Q

T/F In a simple path, the first and last vertex cannot be the same

A

F, they can be

22
Q

What is the running time of the Dijkstra algorithm if a linear scan is required to find the cheapest vertex?

A

O(|E| + |V|^2)

23
Q

What is a problem with the maximum flow algorithm?

A

The first path chosen may result in having no other paths from s to t

24
Q

What is an edge to a visited node called?

A

Back edge

25
Q

In a directed graph, is u-v-u a cycle?

A

Yes since the u-v and v-u are different edges

26
Q

What is the running time of a depth first search?

A

O(|E|+|V|)

27
Q

What is a Euler Circuit?

A

Find a cycle that begins and ends at the same point that visits each edge exactly once

28
Q

What is an edge to an unvisited node called?

A

Tree edge

29
Q

When do we know if a graph has a Euler Path?

A

If the graph has no more than two vertices with odd degree

30
Q

What is the running time of Prim’s algorithm?

A

O(|E| log|V|)

31
Q

When is a vertex an articulation point?

A

When a child’s low is >= the parents num

32
Q

How does Krustal’s algorithm work?

A

Build the tree by starting with the cheapest edge between vertices and repeat. Reject any edge that will cause a cycle.

33
Q

What is the running time of the Dijkstra algorithm if a priority queue is used to find the cheapest vertex?

A

O(|E| log|V|)

34
Q

A depth-first search of a graph can produce a ____

A

Depth-first spanning tree

35
Q

T/F Euler circuits can be found using a series of depth-first searches

A

T

36
Q

In an undirected graph, is u-v-u a cycle?

A

No, the edges must be unique

37
Q

How can the maximum flow algorithm be improved?

A

Have a reverse flow so decision can be reversed if needed

38
Q

A depth-first search is a generalization of a ____ to apply to graphs

A

Preorder traversal

39
Q

When is a graph complete?

A

Edges between every pair of vertices

40
Q

Why might a 2D array not be good to represent a graph?

A

It can be a poor use of space if the graph is sparse

41
Q

What is the space requirement of an adjacency list?

A

O(|E|+|V|)

42
Q

What type of tree is a minimum spanning tree?

A

Acyclic

43
Q

How can you solve an unweighted shortest path problem?

A

Treat all edges as having a weight of 1

44
Q

What type of heap does Prim’s algorithm use?

A

Binary heap

45
Q

When is the root an articulation point?

A

When it has more than one child