Graphs Flashcards

1
Q

Define Graph

A
  • abstract data type that can be used to represent complex, non-linear relationships between objects
  • contains nodes and edges
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define neighbour

A

two nodes connected by an edge

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

Define degree

A

number of other nodes that a node is connected to

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

Define loop

A

edge that connects node to itself

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

Define cycle

A

closed path

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

Uses of graphs

A
  • social networking
  • transport networks
  • the internet
  • World wide web
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define undirected graph

A

allows you to traverse in either direction between nodes

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

Define directed graph

A

edges have direction, you move between nodes in specified direction

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

Define weighted graph

A

values associated with the edges

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

Define adjacency matrix

A
  • table
  • 0s if unweighted
  • infinity if weighted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Define adjacency list

A
  • dictionary
  • unweighted: B - D; H
  • weighted: B - D,15; H,40
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Advantages of adjacency lists

A

-space efficient for graphs with few edges (sparse graphs)

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

Disadvantages of adjacency lists

A

-requires linear search when determining presence of an edge

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

Advantages of adjacency matrix

A
  • space efficient for graphs with a lot of edges (denser graphs)
  • good when frequently testing for prescence of edges
How well did you know this?
1
Not at all
2
3
4
5
Perfectly