Repository: networkx/networkx

Issue:
Problem with spiral layout with `equidistant=True`
`nx.spiral_layout` has an `equidistant` kwarg that is False by default. According to the docstring parameter description, this is supposed to enforce that the laid out nodes are all equidistant from one another when True. However, the iterative implementation is such that the node in the first iteration is handled differently than all the rest, resulting in the following behavior:

### Current Behavior

```python
>>> G = nx.path_graph(5)
>>> nx.draw(G, pos=nx.spiral_layout(G, equidistant=True))
```

![fi](https://user-images.githubusercontent.com/1268991/144682663-1655099a-b524-4cfc-a101-68f2ef97865a.png)

### Expected Behavior

The "first" node should (presumably) also be equidistant from it's neighbor

### Environment
Python version: Python 3.9.7
NetworkX version: 2.7rc1.dev0 (766becc1)

### Additional context

`spiral_layout` was added in #3534


Discussion:
As part of this issue we should also add a paragraph to the docstring to describe what a spiral layout is and how it is affected by the `equidistant` option. 

Resolving patch:
diff --git a/networkx/drawing/layout.py b/networkx/drawing/layout.py
--- a/networkx/drawing/layout.py
+++ b/networkx/drawing/layout.py
@@ -957,14 +957,17 @@ def spiral_layout(G, scale=1, center=None, dim=2, resolution=0.35, equidistant=F
         Scale factor for positions.
     center : array-like or None
         Coordinate pair around which to center the layout.
-    dim : int
+    dim : int, default=2
         Dimension of layout, currently only dim=2 is supported.
         Other dimension values result in a ValueError.
-    resolution : float
+    resolution : float, default=0.35
         The compactness of the spiral layout returned.
         Lower values result in more compressed spiral layouts.
-    equidistant : bool
-        If True, nodes will be plotted equidistant from each other.
+    equidistant : bool, default=False
+        If True, nodes will be positioned equidistant from each other
+        by decreasing angle further from center.
+        If False, nodes will be positioned at equal angles
+        from each other by increasing separation further from center.
 
     Returns
     -------
@@ -1003,6 +1006,7 @@ def spiral_layout(G, scale=1, center=None, dim=2, resolution=0.35, equidistant=F
         chord = 1
         step = 0.5
         theta = resolution
+        theta += chord / (step * theta)
         for _ in range(len(G)):
             r = step * theta
             theta += chord / r


Test patch:
diff --git a/networkx/drawing/tests/test_layout.py b/networkx/drawing/tests/test_layout.py
--- a/networkx/drawing/tests/test_layout.py
+++ b/networkx/drawing/tests/test_layout.py
@@ -371,6 +371,15 @@ def test_spiral_layout(self):
             distances_equidistant[1:], distances_equidistant[-1], atol=0.01
         )
 
+    def test_spiral_layout_equidistant(self):
+        G = nx.path_graph(10)
+        pos = nx.spiral_layout(G, equidistant=True)
+        # Extract individual node positions as an array
+        p = np.array(list(pos.values()))
+        # Elementwise-distance between node positions
+        dist = np.linalg.norm(p[1:] - p[:-1], axis=1)
+        assert np.allclose(np.diff(dist), 0, atol=1e-3)
+
     def test_rescale_layout_dict(self):
         G = nx.empty_graph()
         vpos = nx.random_layout(G, center=(1, 1))