title: How to prove a cyclic pattern exists in a series of numbers or characters using C#?
body: <p>This is what I am trying to solve.
  I have a series of numbers like </p>
  
  <pre><code>    1 -&gt; 2
      2 -&gt; 3
      3 -&gt; 4
      4 -&gt; 2
      2 -&gt; 1
  </code></pre>
  
  <p>I need to write a program to prove if these numbers are points on a graph they form some kind of loop. In the above example 1 -> 2 -> 3 -> 4 -> 2 form a loop.</p>
  
  <p>In the following example there is no loop.</p>
  
  <pre><code>    1 -&gt; 2
      2 -&gt; 3
      3 -&gt; 4
      3 -&gt; 5
  </code></pre>
  
  <p>Don't understand how this is a duplicate. Sorry if my question is not clear. I am trying my level best to describe it.
  I have set of points/numbers/nodes. They are in pair and also they have direction.
  For example pair of numbers are 
          1 -> 2
          2 -> 3
          1 -> 2
          3 -> 4
          4 -> 2
          2 -> 1
          3 -> 4</p>
  
  <p>When these individual nodes are connected from top to bottom I will get linked lists as below
         1 -> 2 -> 3 -> 1 -> 2 -> 3 -> 4 -> 2 -> 1 -> 3 -> 4</p>
  
  <p>I am not looking for a repeated pattern in this set of numbers. trying to find closed loops like 1 -> 2 -> 3 -> 1 is a loop. 2 -> 3 -> 1 -> 2 is a loop. 3 -> 1 -> 2 -> 3, 2 -> 3 -> 4 -> 2,  3 -> 4 -> 2 -> 1 -> 3 etc.
  in this wiki link there is one loop that is 1 _. 6 -> 3 -> 1 <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Functional_graph.svg/240px-Functional_graph.svg.png" rel="nofollow">http://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Functional_graph.svg/240px-Functional_graph.svg.png</a> </p>
  
  <p>Hope this makes the question clear!</p>