Graphs Flashcards

1
Q

What is a Breadth-First Search?

A

Starts at the root and explores all nodes at the present depth, then moving on to the next depth level

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

What is a Depth-First Search

A

Starts at the root node and explores as far as possible along each branch before backtracking.

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

What is the advantage of an adjacency matrix?

A

They are time efficient, since each edge can be specifically queried very quickly using rows and columns.

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

What is the disadvantage of an adjacency matrix?

A

They are memory inefficient, as each edge between nodes are stored, even if they don’t exist.

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

When would you use an adjacency matrix?

A

For a dense graph with a large number of edges.

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

What is the advantage of an adjacency list?

A

They are memory efficient, as they only store edges that exist in the graph.

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

What is the disadvantage of an adjacency list?

A

They are time inefficient, as each item in a list must be searched sequentially until the desired edge is found.

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

When would you use an adjacency list?

A

For a sparse graph with few edges.

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

What are the 3 characteristics of a Tree?

A
  • Connected
  • No cycles
  • Undirected
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does it mean when a graph is weighted?

A

It’s edges are assigned a value that can represent values such as time, distance or cost.

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