Section 7 Chapter 41 - Graphs Flashcards

1
Q

Graph

A

A set of nodes that are connect by edges. Can be used to represent complex relationships

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

Weighted Graph

A

A graph where each edge has a number associated with it. This is often the ‘cost’ to move along that edge

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

Node

A

A point on a graph. Nodes are connected to each other by edges and can often represent locations or states.

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

Edge

A

An edge connects to nodes. Edges often represent a movement or a change

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

Undirected graph

A

Edges are all bidirectional. This means that all edges can be travelled across in both directions

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

Directed graph

A

All the edges are one way

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

Common uses for graphs (4)

A
  • Showing road connections between cities
  • FSM
  • Representing a computer network
  • Showing links between web pages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Adjacency matrix

A

A table that can be represented with a two dimensional array. It represents the nodes of a graph and the connections between these nodes.

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

What an undirected graph adjacency matrix will look like

A

symmetrical

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

How to represent an unweighted graph with an adjacency matrix

A

0s and 1s

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

Adjacency list

A

A list of all nodes. Each node in the list points to a list of its adjacent nodes and the weights. Can be represented as a list of dictionaries

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

Adjacency matrix vs adjacency list

A

Adjacency matrix
+ Adding an edge is easy
+ Testing for the presence of an edge is easy
- In a graph with lots of nodes but few edges, a adjacency matrix would have a lot of empty wasted space
Adjacency list
- More space efficient

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