Re: Hamiltoncircuits on polyhedra
- To: mathgroup at smc.vnet.net
- Subject: [mg60419] Re: Hamiltoncircuits on polyhedra
- From: "Valeri Astanoff" <astanoff at yahoo.fr>
- Date: Fri, 16 Sep 2005 03:48:58 -0400 (EDT)
- References: <dgber8$fn8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Mr. Lucassen, Hamiltonian circuits on polyhedra? The function "HamiltonianCycle" is available in the package DiscreteMath`Combinatorica` Example of a cube : In[1]:=<<DiscreteMath`Combinatorica` In[2]:=verts = Range[8] Out[2]={1,2,3,4,5,6,7,8} In[3]:=eds = {{1,2},{2,3},{3,4},{4,1}, {1,5},{2,6},{3,7},{4,8}, {5,6},{6,7},{7,8},{8,5}}; In[4]:=conn[x_,y_] := MemberQ[eds,{x,y}] || MemberQ[eds,{y,x}] In[5]:=gr = MakeGraph[verts,conn]; In[6]:=HamiltonianCycle[gr,All] Out[6]= {{1,2,3,4,8,7,6,5,1}, {1,2,3,7,6,5,8,4,1}, {1,2,6,5,8,7,3,4,1}, {1,2,6,7,3,4,8,5,1}, {1,4,3,2,6,7,8,5,1}, {1,4,3,7,8,5,6,2,1}, {1,4,8,5,6,7,3,2,1}, {1,4,8,7,3,2,6,5,1}, {1,5,6,2,3,7,8,4,1}, {1,5,6,7,8,4,3,2,1}, {1,5,8,4,3,7,6,2,1}, {1,5,8,7,6,2,3,4,1}} Europeanly yours, Valeri Astanoff