Graphs and trees Flashcards

1
Q

Define an undirected graph

A

A graph where the relationship between vertices is two way

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

Define a directed graph

A

A graph where the relationship between vertices i one way

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

What are the important parts of graphs and trees?

A

Vertex/vertices - an object in a graph (also know as a node)

Arc - the join/relationship between two nodes

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

What is the difference between a weighted and an unweighted graph?

A

A weighted graph has values between/for the node.

An unweighted graph has no values for each arc.

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

List some uses for graphs

A

Human networks - Each node is a person and each arc is the relationship between them
Transport networks - All locations on the networks are nodes on the graph and the arcs the routes between them

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

Define adjacency list

A

A data structure that stores a list of nodes with their adjacent nodes

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

Define adjacency matrix

A

A data structure set up as a two dimensional array or grid that shows whether there is an edge between each pair of nodes

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

Adjacency list VS adjacency matrix

A

Adjacency list;
-Only stores data where there is an edge. less storage space
-It has to be tested every time to see if two nodes connect. Increases processing time
Adjacency matrix;
-Stores values for every combination. Takes up a lot of space
-Adjacencies can be identified more quickly

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

Define tree in relation to computing

A

a data structure similar to a graph but with no loops

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

What are the parts of a tree in relation to computing?

A

Node - An object on the graph
Edge - A join or relationship between two nodes
Root - The starting node from which the whole data structure stems off
Parent - A type of node on the tree with further nodes below it
Child - A node on the tree that has more node above it
Leaf - A node that doesn’t have any node beneath it

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

What is a binary search tree?

A

A type of tree where each parent node can only have two children

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

How would you store a binary search tree in a three dimensional array?

A

The first layer would store the data in the node.
The second layer would store the left connecting node.
The third layer would store the right connecting node

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