4.3.1 Graph Traversal Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is an algorithm?

A

A set of instructions which completes a task within a finite time and terminates upon completion.

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

What is Graph Traversal?

A

The process of visiting each vertex in a graph.

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

Name two types of graph traversal.

A

Depth-first Search and Breadth-first Search

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

Which traversal is best for navigating a maze?

A

Depth-first search

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

What is breadth-first search useful for?

A

Shortest path on an unweighted graph

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

What ADT is used for a breadth-first traversal?

A

Queue

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

What ADT is used for a depth-first search?

A

Stack

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

What type of graphs can be traversed?

A

Connected graphs

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

Can a tree undergo depth-first traversal?

A
  • Yes
  • But it might be more appropriate to use a tree traversal in such a situation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Can a graph traversal start from any node?

A
  • Yes
  • Since it is stored in a way that allows to see which nodes have a vertex between them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In what order would this graph be traversed in a breadth-first search? Start from node A.

  • A → B,C
  • B → C,D
  • C → A,B
  • D → B,E
A

A→B→C→D→E

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

In what order would this graph be traversed in a depth-first search? Start from node A.

  • A → B,C
  • B → C,D
  • C → A,B
  • D → B,E
A

A → B → D → E → C

Goes through one pathway completely before exploring the other.

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