title: Find all cycles in directed graph
body: <p>I'm using the following python code to find out any cycle in graph but it doesn't return correct results</p>
  
  <pre><code>for node in graph:
      new_path=node
      path = node
      for adjacent in graph.get(node, []):
          if not adjacent in new_path:
              new_path = list(path)
              new_path.append(adjacent)
          else:
              print (new_path)
  </code></pre>
  
  <p>Could you please help me find any cycles in the graph?</p>
  
  <p>Input Sample:</p>
  
  <pre><code>graph = {
      '181': set(['284','248','247','350']),
      '350': set(['400', '401']),
      '400': set(['181', '654'])
  }
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>181 350 400 181
  </code></pre>
  
  <p>My code does not currently output anything.</p>