100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten
logo-home
Computational Thinking Assignment 5 €5,49
In winkelwagen

Case uitwerking

Computational Thinking Assignment 5

 0 keer verkocht

Computational Thinking Assignment 5

Voorbeeld 2 van de 9  pagina's

  • 14 juni 2022
  • 9
  • 2019/2020
  • Case uitwerking
  • Bhulai
  • 9-10
Alle documenten voor dit vak (7)
avatar-seller
TR19
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.

Dit zijn jouw voordelen als je samenvattingen koopt bij Stuvia:

Bewezen kwaliteit door reviews

Bewezen kwaliteit door reviews

Studenten hebben al meer dan 850.000 samenvattingen beoordeeld. Zo weet jij zeker dat je de beste keuze maakt!

In een paar klikken geregeld

In een paar klikken geregeld

Geen gedoe — betaal gewoon eenmalig met iDeal, creditcard of je Stuvia-tegoed en je bent klaar. Geen abonnement nodig.

Direct to-the-point

Direct to-the-point

Studenten maken samenvattingen voor studenten. Dat betekent: actuele inhoud waar jij écht wat aan hebt. Geen overbodige details!

Veelgestelde vragen

Wat krijg ik als ik dit document koop?

Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.

Tevredenheidsgarantie: hoe werkt dat?

Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.

Van wie koop ik deze samenvatting?

Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper TR19. Stuvia faciliteert de betaling aan de verkoper.

Zit ik meteen vast aan een abonnement?

Nee, je koopt alleen deze samenvatting voor €5,49. Je zit daarna nergens aan vast.

Is Stuvia te vertrouwen?

4,6 sterren op Google & Trustpilot (+1000 reviews)

Afgelopen 30 dagen zijn er 64419 samenvattingen verkocht

Opgericht in 2010, al 15 jaar dé plek om samenvattingen te kopen

Begin nu gratis
€5,49
  • (0)
In winkelwagen
Toegevoegd