5 views

Uploaded by Victor

UNSW tutorial

- Critcal Path Analysis
- d-samanta data structre.pdf
- IOI Syllabus
- Model Question Paper MC0068
- Search in artificial intelligence
- Basic Recap and Revision
- Gate Cs –
- Minimum Spanning Tree Parallel
- Operations Research Assignment
- DFS and BFS algorithm
- Graph traversal algorithm
- VC-Savage
- Total Irregularity Strength for Cartesian Product Two Path
- lecture18.ppt
- 10.1.1.89
- Michel Deza, Mathieu Dutour Sikiric and Mikhail Shtogrin- Elementary polycycles
- Problems ITYM2017
- dsgt_2006
- Graph Course
- 1 Bass TMME2011 Article1 Pp.3 34

You are on page 1of 4

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

Directed graph: one side represents from, one side represents to.

Uses a lot of space. Size of matrix: V * V => huge, but if few connections, only one

entry.

Complete waste of space if there are few edges

(b).

Adjacency list representation: a jagged list of lists

0

12

1

02

2

034

3

12

4

25

5

4

6

- array of ptrs

null

Again, represented twice for an undirected graph. And only once for a directed

graph.

More space efficient: space used = twice the amount of edges (for undirected) that

exist

There is a certain point where adjacency lists will use more memory than matrices.

Worse time complexity: need to scan through each list.

Q6.

Write a function to count the number of edges in a graph:

int nEdges (Graph g)

{

int count = 0;

for (int i = 0; i < g->nV; i++) {

for (int j = i+1; j < g->nV; j++) {

count += g->edges[i][j];

}

}

// 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:

===================

nothing

0

0

1

- 1 is neighbour of 0

(visited: 0)

1

234

- could add 1 to the queue and check later

visited: (0,

1)

2

3435

- 1 is in visited but 3 isnt, so duplicate, but possible to

implement

some way to avoid this

visited: (0,1,5)

3

43545

visited: (0,1,5,3)

4

35455

etc. put 4 in visited

3

5455

- already in visited

5

45567

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

Again, can have visited[] to prevent repeats.

ex. (but eats up your stack frame - stack overflow)

void explore (current_node):

for all the current nodes neighbours:

visit neighbour

No need to write up a stack - we just borrow the stack in memory

- Critcal Path AnalysisUploaded byatikson
- d-samanta data structre.pdfUploaded byAkash Bhagat
- IOI SyllabusUploaded byMohammad Mynoddin
- Model Question Paper MC0068Uploaded bygobeyondsky2
- Search in artificial intelligenceUploaded byseasalt14
- Basic Recap and RevisionUploaded byGabriel Kamau
- Gate Cs –Uploaded bymalikckbe
- Minimum Spanning Tree ParallelUploaded byHarsh Singh
- Operations Research AssignmentUploaded byCharith Akalanka
- DFS and BFS algorithmUploaded byRohan Chavan
- Graph traversal algorithmUploaded bysru_scribd
- VC-SavageUploaded byishan_chawla123
- Total Irregularity Strength for Cartesian Product Two PathUploaded byMuhammad Riski Maulana
- lecture18.pptUploaded bysamgalforyou
- 10.1.1.89Uploaded byMyda Rafael
- Michel Deza, Mathieu Dutour Sikiric and Mikhail Shtogrin- Elementary polycyclesUploaded byFlaoeram
- Problems ITYM2017Uploaded byIustin Surubaru
- dsgt_2006Uploaded byandhracolleges
- Graph CourseUploaded byLitu Cristina
- 1 Bass TMME2011 Article1 Pp.3 34Uploaded byAhmad Syukri
- Putnam Sol2013Uploaded byropiu
- Actp Iori Route 2011 (Slides)Uploaded byEduardo Moreira
- Hurara Discrete AssignmentUploaded bySyed Safwan
- Hurara Discrete AssignmentUploaded bySyed Safwan Abbas Naqvi
- connectLANsUploaded byArturoEnriqueCruzHernandez
- Chapter 2.pdfUploaded byArliefy Ehsany
- L15 Graph Part04Uploaded byEnmusk
- Fidelity Placement Paper | Freshers ChoiceUploaded byfresherschoice
- Report1fUploaded bySriniketh Vijayaraghavan
- Assignment01.pdfUploaded byKushal Bajaj

- Summary Notes - COMP2911Uploaded byVictor
- 05 - Greedy - GraphsUploaded byVictor
- wk2 notes 2911Uploaded byVictor
- Week 1 Lecture Notes - COMP2911.rtfUploaded byVictor
- Week5 Lab ReportUploaded byVictor
- cs1927 15s2 - Week06 TutUploaded byVictor
- Patent Approved 2015Uploaded byVictor
- 00 - Getting StartedUploaded byVictor
- cs1927 15s2 - Week02 Tut AnsUploaded byVictor
- Consultation Questions ReadingUploaded byVictor
- Introduction - Multiplication by 1Uploaded byVictor
- electrochemical series.pdfUploaded byheitorpcents496
- Reflection - VictorUploaded byVictor
- cs1927 15s2 - Tut Week01 AnsUploaded byVictor
- Summary 1131 AlgUploaded byVictor
- Summary Lin AlgUploaded byVictor
- Dracula and the LadsUploaded byVictor
- [00 Introduction] Research LinksUploaded byVictor
- Steps in Amplifier AnalysisUploaded byVictor
- Python CheatsheetUploaded byVictor
- cs1927 15s2 - Week09 TutUploaded byVictor
- cs1927 15s2 - Week05 TutUploaded byVictor
- tute_labUploaded byVictor
- Week 1 Lecture Notes - COMP2911Uploaded byVictor
- cs1927 15s2 - Week04 TutUploaded byVictor
- Week08 TutUploaded byVictor
- cs1927 15s2 - wk10_tutUploaded byVictor

- Singapore HC Information Kit_book1_FA-5Uploaded byTenri3232
- CisternostomyUploaded byIype Cherian
- Business ProposalUploaded byDebi Colin Cusi
- [Cristiano_Bee_(auth.)]_Active_Citizenship_in_Euro(b-ok.xyz).pdfUploaded bygoot
- Application Form AWKUM-New (1)Uploaded byAamir Khan
- ccc wordUploaded byDilip Bhagat
- Engineering Economics TutorialUploaded byJoy Sims
- Zero Waste to LandfillUploaded byAntonio Oswaldo Storel Junior
- Depression Analysis using Sentiment Analysis via Social MediaUploaded byAnonymous izrFWiQ
- Bomb LabUploaded byHector David
- Sbi Power CapsuleUploaded byKaku Ghoshal
- Samuel L. Greitzer - International Mathematical Olympiads 1959-1977Uploaded byLondres des
- Biographia Literaria Chapter 7-8Uploaded byRenu Elizabeth Abraham
- Folio KerjayaUploaded byZaini Aman
- factors for choosing a bankUploaded bybusssy
- UntitledUploaded byoutdash2
- Numerus Mysticorum - The Divine Origin of the Fine Structure ConstantUploaded byhashcode
- Evermotion Archexteriors Vol 4 PDFUploaded byKathy
- Alpita ProjectUploaded bykpved92
- SmitUploaded bypic2007
- The Art of Interaction-edmonundUploaded byCarlo Penzo
- wrgsdgwfUploaded bySajith Vasudev
- your rubric story writing how things came to be- myth writing assignmentUploaded byapi-311514914
- paper92.pdfUploaded bysha3107
- PracticeMock Bazooka September 2018 EditionUploaded byCheena
- 2011-570, State of New Hampshire v. Daniel CasanovaUploaded byChris Buck
- EDLD 6367 Theories of Educational Leadership, William Allan Kritsonis, PhD, Professor of Educational Leadership, The University of Texas of the Permian BasinUploaded byAnonymous sewU7e6
- Torchbearer Character SheetUploaded byFelan
- Hazard IdentificationUploaded byClaudette Lui Cabanos- Mercado-Reyes
- The Baker LetterUploaded by7ccerna