Enigmatics

Enigma 1468

Posted on: Thursday 29/11, 2007;  2:12 PM

Load the Combinatorica package for doing operations on graphs.

"BE3405334364_1.gif"

Define a function for omputing 2D indexing from 1D indexing on a 6 by 6 array.

"BE3405334364_2.gif"

Define a function for computing if a pair of nodes is adjacent in a Manhattan metric. You could use GridGraph[6,6] instead, but I want to show how to use an explicit adjacency function here.

"BE3405334364_3.gif"

Define a function for testing if adjacency between a pair of nodes is excluded.

"BE3405334364_4.gif"

Use these adjacency functions to define an adjacency matrix.

"BE3405334364_5.gif"

Use this adjacency matrix to define an adjacency function.

"BE3405334364_6.gif"

Define the layout (i.e. embedding) of the graph.

"BE3405334364_7.gif"

Display the graph.

"BE3405334364_8.gif"

"BE3405334364_9.gif"

HamiltonianCycle is not designed to work on directed graphs, so the following step is not strictly valid.

Compute all of the Hamiltonian cycles in the graph. There is only one, as expected.

"BE3405334364_10.gif"

"BE3405334364_11.gif"

Extract the edges in the Hamiltonian cycle.

"BE3405334364_12.gif"

Define a function for drawing only the edges that lie on the Hamiltonian cycle.

"BE3405334364_13.gif"

Display the Hamiltonian cycle.

"BE3405334364_14.gif"

"BE3405334364_15.gif"

Rotate the Hamiltonian cycle so that it starts at the correct node.

"BE3405334364_16.gif"

"BE3405334364_17.gif"

Compute which positions in the Hamiltonian cycle fall on the nodes labelled "ENIGMA".

"BE3405334364_18.gif"

"BE3405334364_19.gif"

Permalink   Notebook

Recent Posts
14/12, 2007; 1:36 PM:
Enigma 1473
9/12, 2007; 12:40 PM:
Enigma 1472
2/12, 2007; 11:55 AM:
Enigma 1471
1/12, 2007; 5:33 PM:
Enigma 1467
29/11, 2007; 3:27 PM:
Enigma 1469
29/11, 2007; 2:12 PM:
Enigma 1468
29/11, 2007; 1:09 PM:
Enigma 1465
27/11, 2007; 8:39 PM:
Enigma 1462
27/11, 2007; 8:38 PM:
Enigma 1464
27/11, 2007; 8:35 PM:
Enigma 1463
27/11, 2007; 8:23 PM:
Enigma 1461
27/11, 2007; 8:19 PM:
Enigma 1460
27/11, 2007; 8:14 PM:
Enigma 1459
27/11, 2007; 8:09 PM:
Enigma 1458
27/11, 2007; 7:42 PM:
Welcome

Archive


Links
COMMENTS

 

Blogged from
A WorkLife FrameWork by
Scientific Arts

All material on this website Copyright © 2007, Stephen Luttrell.