Professional Documents
Culture Documents
Stage 1: fill out and implement the ADTs (we write AIs in Round 2)
GameView: access to all info to state of game
Design decision as to what to put in the struct
DracView, HunterView: access to a limited amount of info
Call stuff from GameView, but neither player calls from GameView directly
Cant modify header files and their signatures in Round 1. In Round 2 (AI), you are
welcome to
change stuff as you like.
Q3
Path: sequence of edges (connected by one another)
Shortest path is 1 edge
Cycle: edges bring you back to the same starting vertex
e.g. in tutorial: abcdefghikja
Tree: graph without any cycles
From the current graph, delete all edges that make it not a tree
e.g. delete the star, b-f, i-k, k-h
Spanning tree: a tree able to reach every node
Clique: totally connected subgraph - i.e. fully connected
Every node connected to every other node by a single edge
e.g. bcdef is a clique
e.g. smallest clique: a triangle
Q4.
1
0
3
2
4
(a).
6 vertices: therefore 6x6 matrix
012345
weight.
0
011
1
2
3
4
5
10 1
1
11
11
1
1
1
1
02
2
034
3
12
4
25
5
4
6
- array of ptrs
null
// triangle method
// could also count weight
}
Consider a triangle of the matrix
Could count all 1s, and divide by 2 (need to check no node points to itself or handle it
otherwise)
Q11.
BFS: explore nodes closest to it
DFS: go far away
Writing each one is the same - just that one uses a queue and one uses a stack.
BFS for example graph in q11:
67
6
7
- 6 has no neighbouring nodes
7
nothing - finished BFS
DFS:
current node queue
===================
nothing
0
0
1
1
234
4
5
7
out.
2335
67
nothing