Repository: networkx/networkx

Issue:
Wrong doc or behavior for simple_cycles
On 1.9.1, we can read on simple_cycles' documentation:
Returns:    cycle_generator: generator
A generator that produces elementary cycles of the graph. **Each cycle is a list of nodes with the first and last nodes being the same.** [emphasis added]

I wrote a simple test case and the result doesn't respect the sentence in bold.

``` python
>>> import networkx as nx
>>> graph = nx.DiGraph()
>>> graph.add_nodes_from(['A', 'B', 'C'])
>>> graph.add_edges_from({('A', 'B'), ('B', 'C'), ('C', 'A')})
>>> list(nx.simple_cycles(graph))
[['A', 'B', 'C']]
```

I thought the result would be `[['A', 'B', 'C', 'A']]`
I also tested on the latest release 1.10 and I obtain the same result.



Discussion:
Thank you!!  ...  I'll get that fixed.  
Looks like it was changed in 1.8 without changing documentation. oops. 

`Each cycle is represented by a list of nodes along the cycle.`


Resolving patch:
diff --git a/networkx/algorithms/cycles.py b/networkx/algorithms/cycles.py
--- a/networkx/algorithms/cycles.py
+++ b/networkx/algorithms/cycles.py
@@ -105,10 +105,9 @@ def cycle_basis(G,root=None):
 def simple_cycles(G):
     """Find simple cycles (elementary circuits) of a directed graph.
 
-    An simple cycle, or elementary circuit, is a closed path where no
-    node appears twice, except that the first and last node are the same.
-    Two elementary circuits are distinct if they are not cyclic permutations
-    of each other.
+    A ``simple cycle``, or ``elementary circuit``, is a closed path where
+    no node appears twice. Two elementary circuits are distinct if they
+    are not cyclic permutations of each other.
 
     This is a nonrecursive, iterator/generator version of Johnson's
     algorithm [1]_.  There may be better algorithms for some cases [2]_ [3]_.
@@ -121,8 +120,8 @@ def simple_cycles(G):
     Returns
     -------
     cycle_generator: generator
-       A generator that produces elementary cycles of the graph.  Each cycle is
-       a list of nodes with the first and last nodes being the same.
+       A generator that produces elementary cycles of the graph.
+       Each cycle is represented by a list of nodes along the cycle.
 
     Examples
     --------
@@ -226,13 +225,12 @@ def _unblock(thisnode,blocked,B):
 def recursive_simple_cycles(G):
     """Find simple cycles (elementary circuits) of a directed graph.
 
-    A simple cycle, or elementary circuit, is a closed path where no
-    node appears twice, except that the first and last node are the same.
-    Two elementary circuits are distinct if they are not cyclic permutations
-    of each other.
+    A ``simple cycle``, or ``elementary circuit``, is a closed path where
+    no node appears twice. Two elementary circuits are distinct if they
+    are not cyclic permutations of each other.
 
     This version uses a recursive algorithm to build a list of cycles.
-    You should probably use the iterator version caled simple_cycles().
+    You should probably use the iterator version called simple_cycles().
     Warning: This recursive version uses lots of RAM!
 
     Parameters
@@ -242,8 +240,8 @@ def recursive_simple_cycles(G):
 
     Returns
     -------
-    A list of circuits, where each circuit is a list of nodes, with the first
-    and last node being the same.
+    A list of cycles, where each cycle is represented by a list of nodes
+    along the cycle.
 
     Example:
 


Test patch: