Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Case uitwerking

Computational Thinking Assignment 5

Beoordeling
-
Verkocht
-
Pagina's
9
Cijfer
9-10
Geüpload op
14-06-2022
Geschreven in
2019/2020

Computational Thinking Assignment 5

Voorbeeld van de inhoud

Computational Thinking – Assignment 5 (Artificial Intelligence Year 1)


1. Hamiltonian path

A Hamiltonian path is a path in an (un)directed graph that visits each vertex exactly once.

We need to find a Hamiltonian path in the following graph 1:









Hamiltonian graph 1 Hamiltonian path graph 2

My path goes like this: 1 > 5 > 3 > 7 > 6 > 12 > 11 > 8 > 10 > 4 > 9 > 2 > 1.

As you can see, graph 2 in this case, is also a Hamiltonian cycle or circuit. This means that the
path visits all the vertices before returning to the starting vertex of this graph.


2. Weighted matrix to weighted graph

Given is the following graph:

A B C D E F
A - 2 3 4 - -
B - - 1 - - 7
C 3 2 - - - 6
D - - - - 8 -
E - - - 7 - 4
F - 6 6 - - -


A. We need to draw the corresponding graph in Python.
Input =

, Computational Thinking – Assignment 5 (Artificial Intelligence Year 1)


Output =




I noticed that every time I clicked on “Run”, the weighted graph changed of shape. Here are




some examples:



All these weighted graphs are practically the same. Also, I noticed that I could change the
shape myself by dragging the vertices.

B. This graph is a mixed, weighted graph. Mixed, because it has both undirected (symmetric) and
directed (asymmetric) parts. Weighted, because every edge has a ‘weight’ assigned to it.

C. We need to show what the shortest path from A to F is.

A B C D E F
A - 2 3 4 - -
B - - 1 - - 7
C 3 2 - - - 6
D - - - - 8 -
E - - - 7 - 4
F - 6 6 - - -
Possible options to go from A to F:
 A>B>F=2+7=9
 A >C>F=3+6=9
 A>B>C>F=2+1+6=9
 A > C > B > F = 3 + 2 + 7 = 12
 A > D > E > F = 4 + 8 + 4 = 16

As you can see there are 3 options with the same minimum weight. A path is a finite or infinite
sequence of edges which connect a sequence of vertices which are all distinct from one
another. The shortest path to get from A to F in this case is:

A via B to F;

A via C to F;

A via B via C to F.

It doesn’t matter which path of these 3 you choose, because they have the same weight.

Documentinformatie

Geüpload op
14 juni 2022
Aantal pagina's
9
Geschreven in
2019/2020
Type
Case uitwerking
Docent(en)
Bhulai
Cijfer
9-10
€5,99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
TR19

Maak kennis met de verkoper

Seller avatar
TR19 Vrije Universiteit Amsterdam
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
9 jaar
Aantal volgers
0
Documenten
7
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen