<p>Hamiltonian cycle from your graph: <a href="http://figshare.com/articles/Hamiltonian_Cycle/1228800" rel="noreferrer">http://figshare.com/articles/Hamiltonian_Cycle/1228800</a></p>

<p>How to find Hamiltonian cycle in your graph in C#:</p>

<p>First file:</p>

<pre><code>using System;
using System.Collections.Generic;

namespace Graph
{
    partial class Program
    {
        static List&lt;string&gt; vertices;
        static void Main(string[] args)
        {
            List&lt;int&gt;[] graph = GetGraph();
            List&lt;int&gt; HamiltonianCycle = Algorithm(graph);
            string a = Translate(HamiltonianCycle);
            Console.Write(a);
            Console.ReadKey();
        }
        static List&lt;int&gt;[] GetGraph()
        {
            List&lt;string&gt; list = new List&lt;string&gt;(){"A","B","C","D","E","F","G","H","I","J"};
            vertices = new List&lt;string&gt;();
            for(int a=0;a&lt;10;++a)
                for(int b=0;b&lt;10;++b)
                    for(int c=0;c&lt;10;++c)
                        for(int d=0;d&lt;10;++d)
            {
                if(a==b || a== c || a==d || b == c || b == d|| c==d)
                    continue;
                string vertex = list[a] + list[b] + list[c] + list[d];
                vertices.Add(vertex);
            }
            List&lt;int&gt;[] graph = new List&lt;int&gt;[vertices.Count];
            for(int i=0;i&lt;graph.Length;++i)
                graph[i] = new List&lt;int&gt;();
            foreach(string s1 in vertices)
                foreach(string s2 in vertices)
                    if(s1 != s2)
                        if(s1[s1.Length-3] == s2[0] &amp;&amp; s1[s1.Length-2] == s2[1] &amp;&amp; s1[s1.Length-1] == s2[2])
            {
                int v1 = vertices.IndexOf(s1);
                int v2 = vertices.IndexOf(s2);
                graph[v1].Add(v2);
            }
            return graph;
        }
        static string Translate(List&lt;int&gt; HamiltonianCycle)
        {
            string a = "";
            foreach(int b in HamiltonianCycle)
                a += vertices[b] + " -&gt; ";
            return a;
        }
    }
}
</code></pre>

<p>Second file:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;

namespace Graph
{
    partial class Program
    {
        static List&lt;int&gt;[] graph, oppositeGraph;
        static List&lt;int&gt; HamiltonianCycle;
        static bool endOfAlgorithm;
        static int level, v1, v2;
        static List&lt;int&gt; Algorithm(List&lt;int&gt;[] graphArgument)
        {
            graph = SaveGraph(graphArgument);
            HamiltonianCycle = new List&lt;int&gt;();
            endOfAlgorithm = false;
            level = 0;
            RemoveMultipleEdgesAndLoops(graph); //3.1
            CreateOppositeGraph(graph);
            bool HamiltonianCycleCantExist = AnalyzeGraph(new List&lt;Edge&gt;()); //6.1.a
            ReverseGraph();
            if (!HamiltonianCycleCantExist)
                FindHamiltonianCycle(GetNextVertex()); //5.3
            HamiltonianCycle.Reverse();
            return HamiltonianCycle;
        }
        static void ReverseGraph()
        {
            graph = SaveGraph(oppositeGraph);
            CreateOppositeGraph(graph);
        }
        static void FindHamiltonianCycle(int a)
        {
            if (!endOfAlgorithm)
            {
                ++level;
                if (HamiltonianCycleFound())
                    endOfAlgorithm = true;
                SortList(a); //5.4
                while (graph[a].Count &gt; 0 &amp;&amp; !endOfAlgorithm)
                {
                    List&lt;Edge&gt; removedEdges = new List&lt;Edge&gt;();
                    int chosenVertex = graph[a][0];
                    graph[a].Remove(chosenVertex);
                    List&lt;int&gt;[] currentGraph = SaveGraph(graph);
                    #region 6.2
                    foreach (int b in graph[a])
                    {
                        removedEdges.Add(new Edge(a, b));
                        oppositeGraph[b].Remove(a);
                    }
                    graph[a].Clear();
                    #endregion
                    graph[a].Add(chosenVertex);
                    v1 = a;
                    v2 = chosenVertex;
                    bool HamiltonianCycleCantExist = AnalyzeGraph(removedEdges); //6.1.b
                    if (!HamiltonianCycleCantExist)
                    {
                        FindHamiltonianCycle(GetNextVertex()); //5.5
                        RestoreGraphs(currentGraph); //6.4
                    }
                    else
                    {
                        foreach (Edge e in removedEdges) //6.3
                        {
                            graph[e.from].Add(e.to);
                            oppositeGraph[e.to].Add(e.from);
                        }
                        RemoveEdge(new Edge(a, chosenVertex), graph, oppositeGraph);
                    }
                }
                if (!endOfAlgorithm)
                {
                    --level;
                    if (level == 0)
                        endOfAlgorithm = true;
                }
            }
        }
        static bool HamiltonianCycleFound()
        {
            foreach (List&lt;int&gt; list in graph)
                if (list.Count != 1)
                    return false;
            HamiltonianCycle = GetHamiltonianCycle(graph);
            return true;
        }
        static List&lt;int&gt; GetHamiltonianCycle(List&lt;int&gt;[] graphArgument)
        {
            List&lt;int&gt; cycle = new List&lt;int&gt;() { 0 };
            while (true)
            {
                if (cycle.Count == graphArgument.Length &amp;&amp; graphArgument[cycle.Last()].Contains(cycle[0]))
                    return cycle;
                if (cycle.Contains(graphArgument[cycle.Last()][0]))
                    return new List&lt;int&gt;();
                else
                    cycle.Add(graphArgument[cycle.Last()][0]);
            }
        }
        static int GetNextVertex()
        {
            List&lt;int&gt; correctOrder = GetCorrectOrder(graph);
            foreach (int a in correctOrder)
                if (graph[a].Count != 1)
                    return a;
            return 0;
        }
        static bool AnalyzeGraph(List&lt;Edge&gt; removedEdges)
        {
            bool HamiltonianCycleCantExist = false;
            int a;
            do
            {
                a = removedEdges.Count;
                HamiltonianCycleCantExist = RemoveUnnecessaryEdges(graph, oppositeGraph, removedEdges, false);
                if (!HamiltonianCycleCantExist)
                    HamiltonianCycleCantExist = RemoveUnnecessaryEdges(oppositeGraph, graph, removedEdges, true);
            }
            while (a != removedEdges.Count &amp;&amp; !HamiltonianCycleCantExist);
            if (!HamiltonianCycleCantExist)
                HamiltonianCycleCantExist = GraphIsDisconnected(graph);
            return HamiltonianCycleCantExist;
        }
        static bool RemoveUnnecessaryEdges(List&lt;int&gt;[] graphArgument, List&lt;int&gt;[] oppositeGraphArgument, List&lt;Edge&gt; removedEdges, bool oppositeGraph)
        {
            bool HamiltonianCycleCantExist = false;
            for (int a = 0; a &lt; graphArgument.Length; ++a)
            {
                if (graphArgument[a].Count == 0 //4.1
                    || (graphArgument[a].Count == 1 &amp;&amp; SearchForCycleAmongVerticesOfDegreeEqual1(graphArgument, a)) //4.2.1
                    || (graphArgument[a].Count &gt; 1 &amp;&amp; SearchForCycleAmongVerticesOfDegreeGreaterThan1(a, graphArgument, oppositeGraphArgument))) //4.2.2
                    return true;
                List&lt;Edge&gt; edges = new List&lt;Edge&gt;();
                #region 3.2
                if (graphArgument[a].Count == 1 &amp;&amp; oppositeGraphArgument[graphArgument[a][0]].Count != 1)
                {
                    foreach (int c in oppositeGraphArgument[graphArgument[a][0]])
                        if (c != a)
                            if (!oppositeGraph)
                                edges.Add(new Edge(c, graphArgument[a][0]));
                            else
                                edges.Add(new Edge(graphArgument[a][0], c));
                }
                #endregion
                #region 3.4
                if (graphArgument[a].Count == 1 &amp;&amp; graphArgument[graphArgument[a][0]].Contains(a))
                {
                    if (!oppositeGraph)
                        edges.Add(new Edge(graphArgument[a][0], a));
                    else
                        edges.Add(new Edge(a, graphArgument[a][0]));
                }
                #endregion
                foreach (Edge edge in edges)
                {
                    removedEdges.Add(edge);
                    if (!oppositeGraph)
                        RemoveEdge(edge, graphArgument, oppositeGraphArgument);
                    else
                        RemoveEdge(edge, oppositeGraphArgument, graphArgument);
                }
            }
            return HamiltonianCycleCantExist;
        }
        static bool SearchForCycleAmongVerticesOfDegreeEqual1(List&lt;int&gt;[] graphArgument, int a)
        {
            if(!(a==v1 || a == v2))
                return false;
            List&lt;int&gt; cycle = new List&lt;int&gt;() { a };
            while (true)
                if (graphArgument[cycle.Last()].Count == 1 &amp;&amp; cycle.Count &lt; graphArgument.Length)
                    if (cycle.Contains(graphArgument[cycle.Last()][0]))
                        return true;
                    else
                        cycle.Add(graphArgument[cycle.Last()][0]);
                    else
                        return false;
        }
        static bool SearchForCycleAmongVerticesOfDegreeGreaterThan1(int a, List&lt;int&gt;[] graphArgument, List&lt;int&gt;[] oppossiteGraphArgument)
        {
            if (!ListsAreEqual(graphArgument[a], oppossiteGraphArgument[a], true))
                return false;
            int b = 1;
            for (int c = 0; c &lt; graphArgument.Length &amp;&amp; graphArgument.Length - c &gt; graphArgument[a].Count - b; ++c)
            {
                if (c == a)
                    continue;
                if (ListsAreEqual(graphArgument[c], graphArgument[a], false) &amp;&amp; ListsAreEqual(graphArgument[c], oppossiteGraphArgument[c], true))
                    ++b;
                if (b == graphArgument[a].Count)
                    return true;
            }
            return false;
        }
        static bool ListsAreEqual(List&lt;int&gt; firstList, List&lt;int&gt; secondList, bool EqualCount)
        {
            if (EqualCount &amp;&amp; firstList.Count != secondList.Count)
                return false;
            foreach (int a in firstList)
                if (!secondList.Contains(a))
                    return false;
            return true;
        }
        static void SortList(int a)
        {
            List&lt;int&gt; correctOrder = GetCorrectOrder(oppositeGraph);
            for (int b = 1; b &lt; graph[a].Count; ++b)
                for (int c = 0; c &lt; graph[a].Count - 1; ++c)
                    if (correctOrder.IndexOf(graph[a][c]) &gt; correctOrder.IndexOf(graph[a][c + 1]))
            {
                int n = graph[a][c];
                graph[a][c] = graph[a][c + 1];
                graph[a][c + 1] = n;
            }
        }
        static List&lt;int&gt; GetCorrectOrder(List&lt;int&gt;[] graphArgument) //5.1
        {
            Dictionary&lt;int, int&gt; vertices = new Dictionary&lt;int, int&gt;();
            List&lt;int&gt; order = new List&lt;int&gt;();
            for (int a = 0; a &lt; graphArgument.Length; ++a)
                vertices.Add(a, graphArgument[a].Count);
            IEnumerable&lt;int&gt; v = from pair in vertices orderby pair.Value ascending select pair.Key;
            foreach (int a in v)
                order.Add(a);
            return order;
        }
        static void RemoveEdge(Edge e, List&lt;int&gt;[] graphArgument, List&lt;int&gt;[] oppositeGraphArgument)
        {
            graphArgument[e.from].Remove(e.to);
            oppositeGraphArgument[e.to].Remove(e.from);
        }
        static void RemoveMultipleEdgesAndLoops(List&lt;int&gt;[] graphArgument)
        {
            for (int a = 0; a &lt; graphArgument.Length; ++a)
            {
                graphArgument[a] = graphArgument[a].Distinct().ToList();
                graphArgument[a].Remove(a);
            }
        }
        static void CreateOppositeGraph(List&lt;int&gt;[] graphArgument)
        {
            oppositeGraph = new List&lt;int&gt;[graphArgument.Length];
            for (int a = 0; a &lt; graphArgument.Length; ++a)
                oppositeGraph[a] = new List&lt;int&gt;();
            for (int a = 0; a &lt; graphArgument.Length; ++a)
                foreach (int b in graphArgument[a])
                    oppositeGraph[b].Add(a);
        }
        static void RestoreGraphs(List&lt;int&gt;[] graphArgument)
        {
            graph = new List&lt;int&gt;[graphArgument.Length];
            for (int a = 0; a &lt; graphArgument.Length; ++a)
            {
                graph[a] = new List&lt;int&gt;();
                graph[a].AddRange(graphArgument[a]);
            }
            CreateOppositeGraph(graph);
        }
        static List&lt;int&gt;[] SaveGraph(List&lt;int&gt;[] graphArgument)
        {
            List&lt;int&gt;[] savedGraph = new List&lt;int&gt;[graphArgument.Length];
            for (int a = 0; a &lt; graphArgument.Length; ++a)
            {
                savedGraph[a] = new List&lt;int&gt;();
                savedGraph[a].AddRange(graphArgument[a]);
            }
            return savedGraph;
        }
        static bool GraphIsDisconnected(List&lt;int&gt;[] graphArgument)
        {
            Stack&lt;int&gt; stack = new Stack&lt;int&gt;();
            Color[] colors = new Color[graphArgument.Length];
            colors[0] = Color.Gray;
            stack.Push(0);
            while (stack.Count &gt; 0)
            {
                int a = stack.Pop();
                foreach (int b in graphArgument[a])
                {
                    if (colors[b] == Color.White)
                    {
                        colors[b] = Color.Gray;
                        stack.Push(b);
                    }
                }
                colors[a] = Color.Black;
            }
            foreach (Color c in colors)
                if (c != Color.Black)
                    return true;
            return false;
        }
    }
    class Edge
    {
        public int from, to;
        public Edge(int f, int t)
        {
            from = f;
            to = t;
        }
    }
    enum Color { White, Gray, Black };
}
</code></pre>

<p>I found Hamilonian cycle with modified version of my algorithm: <a href="http://arxiv.org/abs/1405.6347" rel="noreferrer">http://arxiv.org/abs/1405.6347</a> Modifications that were made are:</p>

<ul>
<li>Algorithm searched in opposite graph</li>
<li>Algorithm tested if graph is disconnected</li>
<li>Algorithm did not test "unique neighbours" rule</li>
<li>Algorithm searched for cycles that are not Hamiltonian, starting only from vertices that creates currently visited edge - only in function SearchForCycleAmongVerticesOfDegreeEqual1</li>
</ul>
Fast Hamiltonian cycle calculation
<p>Suppose that there is a directed graph consists of vertices named below:</p>

<pre><code>"ABC", "ABD", "ACB", "ACD", "ADB", "ADC", "BAC", "BAD",
"BCA", "BCD", "BDA", "BDC", "CAB", "CAD", "CBA", "CBD",
"CDA", "CDB", "DAB", "DAC", "DBA", "DBC", "DCA", "DCB"
</code></pre>

<p>These are the 3 letter permutations over 4 different letters. (<code>total = 4*3*2=24</code>)
Name of vertices also describes edges between them. Any two vertices are connected to each other if last two character of source is equal to first two character of destination such as </p>

<p>A<strong>BC</strong> -> <strong>BC</strong>D</p>

<p>or </p>

<p>D<strong>CB</strong> -> <strong>CB</strong>A</p>

<p>The graph is very similar to De Burjin's or Kautz's, but not same. It is strongly connected and I know that it has Hamiltonian cycle.</p>

<p>To solve the problem, I'm not an expert at algorithms, I simply went through latest boost graph library and found hawick_unique_circuits() function which enumerates all cycles and here is my example codes:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdint&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;boost/graph/adjacency_list.hpp&gt;
#include &lt;boost/graph/hawick_circuits.hpp&gt;
#include "combination.hpp" // from http://howardhinnant.github.io/combinations.html

using namespace std;
using namespace boost;

typedef boost::adjacency_list&lt;vecS, vecS, directedS, no_property, property&lt;edge_weight_t, uint32_t&gt; &gt; TGraph;

TGraph m_Graph;

vector&lt;string&gt; m_StrVertexList;

void CreateStringVertexList(vector&lt;string&gt;&amp; vl, uint32_t n, uint32_t k)
{
    vl.clear();

    if ((k &gt; 0) &amp;&amp; (n &gt; k))
    {
        string code = "A";

        while (--n)
        {
            code += code.back() + 1;
        }   

        // for_each_permutation from Howard Hinnant
        // http://howardhinnant.github.io/combinations.html
        for_each_permutation(code.begin(), code.begin() + k, code.end(), 
                             [&amp;](string::iterator first, string::iterator last)-&gt;bool{ vl.push_back(string(first, last)); return(false); });
    }
}

void AddEdgesFromStringVertex(TGraph&amp; g, const vector&lt;string&gt;&amp; vl)
{
    uint32_t connection_len = vl.begin()-&gt;size() - 1;

    g.clear();

    for (uint32_t f = 0; f &lt; vl.size(); f++)
    for (uint32_t t = 0; t &lt; vl.size(); t++)
    {
        if ((f != t) &amp;&amp;
            (vl[f].substr(1, connection_len) == vl[t].substr(0, connection_len)))
        {
            add_edge(f, t, 1, g);
        }
    }
}

class hawick_visitor
{
    public:
    void cycle(const vector&lt;TGraph::vertex_descriptor&gt;&amp; circuit, const TGraph&amp; graph) const
    {
        if (circuit.size() == m_StrVertexList.size())
        {
            for (auto ii = circuit.begin(); ii != circuit.end(); ++ii)
            {
                cout &lt;&lt; m_StrVertexList[*ii] &lt;&lt; " -&gt; ";
            }

            cout &lt;&lt; endl;
        }
    }
};

void Circuits(const TGraph&amp; g)  
{
    hawick_unique_circuits(g, hawick_visitor());

    cout &lt;&lt; "- end of hawick_unique_circuits() -" &lt;&lt; endl;
}

void main(void)
{
    //CreateStringVertexList(m_StrVertexList, 10, 4);

    CreateStringVertexList(m_StrVertexList, 4, 3);
    AddEdgesFromStringVertex(m_Graph, m_StrVertexList);

    Circuits(m_Graph);
}
</code></pre>

<p>hawick_visitor class simply checks whether cycle found has same vertices as Graph's. If it has, that means we find one of Hamiltonian cycle we need.</p>

<p>It works perfectly for 24 vertices which is 3 char chosen from 4 unique char and here is one of outputs:</p>

<pre><code>ABC -&gt; BCA -&gt; CAD -&gt; ADB -&gt; DBC -&gt; BCD -&gt; CDA -&gt; DAC -&gt; 
       ACB -&gt; CBD -&gt; BDC -&gt; DCB -&gt; CBA -&gt; BAC -&gt; ACD -&gt; CDB -&gt; 
       DBA -&gt; BAD -&gt; ADC -&gt; DCA -&gt; CAB -&gt; ABD -&gt; BDA -&gt; DAB -&gt; ABC
</code></pre>

<p>But when I try to solve similar graph has 5040 vertices named as 4 char chosen from 10 unique char, this function never returns. There should be a far better algorithm than hawick_unique_circuits() to do that. Because I know people doing similar calculation for 10,000 vertices less than a minute, but I don't know how. Any idea highly appreciated.</p>

<p>Here is the graph has 5040 vertices that I need to solve:
<img src="https://i.stack.imgur.com/bXWEH.png" alt="enter image description here"></p>