4.2.4 - FoDS (Graphs) Flashcards

1
Q

When are graphs used

A

To represent more complex relationships than stacks and queues

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

What are the typical uses of graphs

A
  • Social Networking
  • Data Transmission
  • Navigation systems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Is a graph dynamic or static and why

A

Dynamic as its size can be modified

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

What is a graph

A

A set of vertices and edges

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

What is a vertex

A

A point on a graph where edges intersect

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

What is an edge

A

A line on a graph that connects a pair of edges

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

What are synonyms for vertices and edges

A

Nodes and arcs

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

What is a sparse graph

A

A graph that has more vertices than edges

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

What is a dense graph

A

A graph with more edges than vertices

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

What is a weighted graph

A

A network with a cost to traverse from one vertex to another

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

What is a directional graph

A

A graph that restricts traversal to one direction

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

What are the two ways that graphs can be represented

A
  • Adjacency matrices
  • Adjacency lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the advantages of matrices

A
  • Time efficient as they are easy to directly locate connections between vertices
  • Adding new edges is easy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the advantages of lists

A
  • They are memory efficient as they don’t include connections between unconnected vertices
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When would you use a list instead of a matrix and vice versa

A

List - sparse graphs
Matrix - dense graphs

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

What is the disadvantage of lists

A
  • There are time inefficient as you have to iterate through the list to find an edge between vertices
17
Q

When are the disadvantages of lists negligible

A

When there is no checking for presence of edges meaning that there will be no iteration

18
Q

What is the disadvantage of matrices

A
  • Using it to store a sparse graph will waste memory as there will be a lot of unconnected vertices
  • If a 2D array is used to store, it can be hard to add and remove nodes