Repository: networkx/networkx

Issue:
Graph generators in the `small` module need docstrings
There are a number of named graphs defined in `networkx.generators.small` that are not well-documented:

https://github.com/networkx/networkx/blob/766becc132eda01c9d0d458de2d75ab763f83493/networkx/generators/small.py#L183-L575

Each of these functions should have a more extensive docstring with at least a `Parameters`, `Returns`, and `Examples` section, and preferably also a reference to the corresponding paper or wiki page that describes the graph.


Discussion:
Hi, 

I have started working on this issue. I noticed that the `LCF_graph` function's docstring has all the details that you have specified in the issue. Can use the same format for rest of the functions? 
That doesn't provide the nice headers that sphinx can make use of.
I would suggest something more like the function [fullrary](https://github.com/networkx/networkx/blob/766becc132eda01c9d0d458de2d75ab763f83493/networkx/generators/classic.py#L67) in `generators/classic.py`

Thanks!

Resolving patch:
diff --git a/networkx/generators/small.py b/networkx/generators/small.py
--- a/networkx/generators/small.py
+++ b/networkx/generators/small.py
@@ -181,7 +181,29 @@ def LCF_graph(n, shift_list, repeats, create_using=None):
 
 
 def bull_graph(create_using=None):
-    """Returns the Bull graph."""
+    """
+    Returns the Bull Graph
+
+    The Bull Graph has 5 nodes and 5 edges. It is a planar undirected
+    graph in the form of a triangle with two disjoint pendant edges [1]_
+    The name comes from the triangle and pendant edges representing
+    respectively the body and legs of a bull.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        A bull graph with 5 nodes
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Bull_graph.
+
+    """
     description = [
         "adjacencylist",
         "Bull Graph",
@@ -193,7 +215,29 @@ def bull_graph(create_using=None):
 
 
 def chvatal_graph(create_using=None):
-    """Returns the Chvátal graph."""
+    """
+    Returns the Chvátal Graph
+
+    The Chvátal Graph is an undirected graph with 12 nodes and 24 edges [1]_.
+    It has 370 distinct (directed) Hamiltonian cycles, giving a unique generalized
+    LCF notation of order 4, two of order 6 , and 43 of order 1 [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        The Chvátal graph with 12 nodes and 24 edges
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Chv%C3%A1tal_graph
+    .. [2] https://mathworld.wolfram.com/ChvatalGraph.html
+
+    """
     description = [
         "adjacencylist",
         "Chvatal Graph",
@@ -218,7 +262,30 @@ def chvatal_graph(create_using=None):
 
 
 def cubical_graph(create_using=None):
-    """Returns the 3-regular Platonic Cubical graph."""
+    """
+    Returns the 3-regular Platonic Cubical Graph
+
+    The skeleton of the cube (the nodes and edges) form a graph, with 8
+    nodes, and 12 edges. It is a special case of the hypercube graph.
+    It is one of 5 Platonic graphs, each a skeleton of its
+    Platonic solid [1]_.
+    Such graphs arise in parallel processing in computers.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        A cubical graph with 8 nodes and 12 edges
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Cube#Cubical_graph
+
+    """
     description = [
         "adjacencylist",
         "Platonic Cubical Graph",
@@ -239,14 +306,55 @@ def cubical_graph(create_using=None):
 
 
 def desargues_graph(create_using=None):
-    """Return the Desargues graph."""
+    """
+    Returns the Desargues Graph
+
+    The Desargues Graph is a non-planar, distance-transitive cubic graph
+    with 20 nodes and 30 edges [1]_.
+    It is a symmetric graph. It can be represented in LCF notation
+    as [5,-5,9,-9]^5 [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Desargues Graph with 20 nodes and 30 edges
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Desargues_graph
+    .. [2] https://mathworld.wolfram.com/DesarguesGraph.html
+    """
     G = LCF_graph(20, [5, -5, 9, -9], 5, create_using)
     G.name = "Desargues Graph"
     return G
 
 
 def diamond_graph(create_using=None):
-    """Returns the Diamond graph."""
+    """
+    Returns the Diamond graph
+
+    The Diamond Graph is  planar undirected graph with 4 nodes and 5 edges.
+    It is also sometimes known as the double triangle graph or kite graph [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Diamond Graph with 4 nodes and 5 edges
+
+    References
+    ----------
+    .. [1] https://mathworld.wolfram.com/DiamondGraph.html
+    """
     description = [
         "adjacencylist",
         "Diamond Graph",
@@ -258,17 +366,58 @@ def diamond_graph(create_using=None):
 
 
 def dodecahedral_graph(create_using=None):
-    """Return the Platonic Dodecahedral graph."""
+    """
+    Returns the Platonic Dodecahedral graph.
+
+    The dodecahedral graph has 20 nodes and 30 edges. The skeleton of the
+    dodecahedron forms a graph. It is one of 5 Platonic graphs [1]_.
+    It can be described in LCF notation as:
+    ``[10, 7, 4, -4, -7, 10, -4, 7, -7, 4]^2`` [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Dodecahedral Graph with 20 nodes and 30 edges
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Regular_dodecahedron#Dodecahedral_graph
+    .. [2] https://mathworld.wolfram.com/DodecahedralGraph.html
+
+    """
     G = LCF_graph(20, [10, 7, 4, -4, -7, 10, -4, 7, -7, 4], 2, create_using)
     G.name = "Dodecahedral Graph"
     return G
 
 
 def frucht_graph(create_using=None):
-    """Returns the Frucht Graph.
+    """
+    Returns the Frucht Graph.
 
     The Frucht Graph is the smallest cubical graph whose
-    automorphism group consists only of the identity element.
+    automorphism group consists only of the identity element [1]_.
+    It has 12 nodes and 18 edges and no nontrivial symmetries.
+    It is planar and Hamiltonian [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Frucht Graph with 12 nodes and 18 edges
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Frucht_graph
+    .. [2] https://mathworld.wolfram.com/FruchtGraph.html
 
     """
     G = cycle_graph(7, create_using)
@@ -293,14 +442,66 @@ def frucht_graph(create_using=None):
 
 
 def heawood_graph(create_using=None):
-    """Return the Heawood graph, a (3,6) cage."""
+    """
+    Returns the Heawood Graph, a (3,6) cage.
+
+    The Heawood Graph is an undirected graph with 14 nodes and 21 edges,
+    named after Percy John Heawood [1]_.
+    It is cubic symmetric, nonplanar, Hamiltonian, and can be represented
+    in LCF notation as ``[5,-5]^7`` [2]_.
+    It is the unique (3,6)-cage: the regular cubic graph of girth 6 with
+    minimal number of vertices [3]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Heawood Graph with 14 nodes and 21 edges
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Heawood_graph
+    .. [2] https://mathworld.wolfram.com/HeawoodGraph.html
+    .. [3] https://www.win.tue.nl/~aeb/graphs/Heawood.html
+
+    """
     G = LCF_graph(14, [5, -5], 7, create_using)
     G.name = "Heawood Graph"
     return G
 
 
 def hoffman_singleton_graph():
-    """Return the Hoffman-Singleton Graph."""
+    """
+    Returns the Hoffman-Singleton Graph.
+
+    The Hoffman–Singleton graph is a symmetrical undirected graph
+    with 50 nodes and 175 edges.
+    All indices lie in ``Z % 5``: that is, the integers mod 5 [1]_.
+    It is the only regular graph of vertex degree 7, diameter 2, and girth 5.
+    It is the unique (7,5)-cage graph and Moore graph, and contains many
+    copies of the Petersen graph [2]_.
+
+    Returns
+    -------
+    G : networkx Graph
+        Hoffman–Singleton Graph with 50 nodes and 175 edges
+
+    Notes
+    -----
+    Constructed from pentagon and pentagram as follows: Take five pentagons $P_h$
+    and five pentagrams $Q_i$ . Join vertex $j$ of $P_h$ to vertex $h·i+j$ of $Q_i$ [3]_.
+
+    References
+    ----------
+    .. [1] https://blogs.ams.org/visualinsight/2016/02/01/hoffman-singleton-graph/
+    .. [2] https://mathworld.wolfram.com/Hoffman-SingletonGraph.html
+    .. [3] https://en.wikipedia.org/wiki/Hoffman%E2%80%93Singleton_graph
+
+    """
     G = nx.Graph()
     for i in range(5):
         for j in range(5):
@@ -316,7 +517,26 @@ def hoffman_singleton_graph():
 
 
 def house_graph(create_using=None):
-    """Returns the House graph (square with triangle on top)."""
+    """
+    Returns the House graph (square with triangle on top)
+
+    The house graph is a simple undirected graph with
+    5 nodes and 6 edges [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        House graph in the form of a square with a triangle on top
+
+    References
+    ----------
+    .. [1] https://mathworld.wolfram.com/HouseGraph.html
+    """
     description = [
         "adjacencylist",
         "House Graph",
@@ -328,7 +548,27 @@ def house_graph(create_using=None):
 
 
 def house_x_graph(create_using=None):
-    """Returns the House graph with a cross inside the house square."""
+    """
+    Returns the House graph with a cross inside the house square.
+
+    The House X-graph is the House graph plus the two edges connecting diagonally
+    opposite vertices of the square base. It is also one of the two graphs
+    obtained by removing two edges from the pentatope graph [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        House graph with diagonal vertices connected
+
+    References
+    ----------
+    .. [1] https://mathworld.wolfram.com/HouseGraph.html
+    """
     description = [
         "adjacencylist",
         "House-with-X-inside Graph",
@@ -340,7 +580,27 @@ def house_x_graph(create_using=None):
 
 
 def icosahedral_graph(create_using=None):
-    """Returns the Platonic Icosahedral graph."""
+    """
+    Returns the Platonic Icosahedral graph.
+
+    The icosahedral graph has 12 nodes and 30 edges. It is a Platonic graph
+    whose nodes have the connectivity of the icosahedron. It is undirected,
+    regular and Hamiltonian [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Icosahedral graph with 12 nodes and 30 edges.
+
+    References
+    ----------
+    .. [1] https://mathworld.wolfram.com/IcosahedralGraph.html
+    """
     description = [
         "adjacencylist",
         "Platonic Icosahedral Graph",
@@ -366,14 +626,33 @@ def icosahedral_graph(create_using=None):
 
 def krackhardt_kite_graph(create_using=None):
     """
-    Return the Krackhardt Kite Social Network.
+    Returns the Krackhardt Kite Social Network.
 
     A 10 actor social network introduced by David Krackhardt
-    to illustrate: degree, betweenness, centrality, closeness, etc.
+    to illustrate different centrality measures [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Krackhardt Kite graph with 10 nodes and 18 edges
+
+    Notes
+    -----
     The traditional labeling is:
     Andre=1, Beverley=2, Carol=3, Diane=4,
     Ed=5, Fernando=6, Garth=7, Heather=8, Ike=9, Jane=10.
 
+    References
+    ----------
+    .. [1] Krackhardt, David. "Assessing the Political Landscape: Structure,
+       Cognition, and Power in Organizations". Administrative Science Quarterly.
+       35 (2): 342–369. doi:10.2307/2393394. JSTOR 2393394. June 1990.
+
     """
     description = [
         "adjacencylist",
@@ -397,14 +676,59 @@ def krackhardt_kite_graph(create_using=None):
 
 
 def moebius_kantor_graph(create_using=None):
-    """Returns the Moebius-Kantor graph."""
+    """
+    Returns the Moebius-Kantor graph.
+
+    The Möbius-Kantor graph is the cubic symmetric graph on 16 nodes.
+    Its LCF notation is [5,-5]^8, and it is isomorphic to the generalized
+    Petersen graph [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Moebius-Kantor graph
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/M%C3%B6bius%E2%80%93Kantor_graph
+
+    """
     G = LCF_graph(16, [5, -5], 8, create_using)
     G.name = "Moebius-Kantor Graph"
     return G
 
 
 def octahedral_graph(create_using=None):
-    """Returns the Platonic Octahedral graph."""
+    """
+    Returns the Platonic Octahedral graph.
+
+    The octahedral graph is the 6-node 12-edge Platonic graph having the
+    connectivity of the octahedron [1]_. If 6 couples go to a party,
+    and each person shakes hands with every person except his or her partner,
+    then this graph describes the set of handshakes that take place;
+    for this reason it is also called the cocktail party graph [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Octahedral graph
+
+    References
+    ----------
+    .. [1] https://mathworld.wolfram.com/OctahedralGraph.html
+    .. [2] https://en.wikipedia.org/wiki/Tur%C3%A1n_graph#Special_cases
+
+    """
     description = [
         "adjacencylist",
         "Platonic Octahedral Graph",
@@ -416,14 +740,51 @@ def octahedral_graph(create_using=None):
 
 
 def pappus_graph():
-    """Return the Pappus graph."""
+    """
+    Returns the Pappus graph.
+
+    The Pappus graph is a cubic symmetric distance-regular graph with 18 nodes
+    and 27 edges. It is Hamiltonian and can be represented in LCF notation as
+    [5,7,-7,7,-7,-5]^3 [1]_.
+
+    Returns
+    -------
+    G : networkx Graph
+        Pappus graph
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Pappus_graph
+    """
     G = LCF_graph(18, [5, 7, -7, 7, -7, -5], 3)
     G.name = "Pappus Graph"
     return G
 
 
 def petersen_graph(create_using=None):
-    """Returns the Petersen graph."""
+    """
+    Returns the Petersen graph.
+
+    The Peterson graph is a cubic, undirected graph with 10 nodes and 15 edges [1]_.
+    Julius Petersen constructed the graph as the smallest counterexample
+    against the claim that a connected bridgeless cubic graph
+    has an edge colouring with three colours [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Petersen graph
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Petersen_graph
+    .. [2] https://www.win.tue.nl/~aeb/drg/graphs/Petersen.html
+    """
     description = [
         "adjacencylist",
         "Petersen Graph",
@@ -449,9 +810,23 @@ def sedgewick_maze_graph(create_using=None):
     """
     Return a small maze with a cycle.
 
-    This is the maze used in Sedgewick,3rd Edition, Part 5, Graph
-    Algorithms, Chapter 18, e.g. Figure 18.2 and following.
+    This is the maze used in Sedgewick, 3rd Edition, Part 5, Graph
+    Algorithms, Chapter 18, e.g. Figure 18.2 and following [1]_.
     Nodes are numbered 0,..,7
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Small maze with a cycle
+
+    References
+    ----------
+    .. [1] Figure 18.2, Chapter 18, Graph Algorithms (3rd Ed), Sedgewick
     """
     G = empty_graph(0, create_using)
     G.add_nodes_from(range(8))
@@ -464,14 +839,58 @@ def sedgewick_maze_graph(create_using=None):
 
 
 def tetrahedral_graph(create_using=None):
-    """Return the 3-regular Platonic Tetrahedral graph."""
+    """
+    Returns the 3-regular Platonic Tetrahedral graph.
+
+    Tetrahedral graph has 4 nodes and 6 edges. It is a
+    special case of the complete graph, K4, and wheel graph, W4.
+    It is one of the 5 platonic graphs [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Tetrahedral Grpah
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Tetrahedron#Tetrahedral_graph
+
+    """
     G = complete_graph(4, create_using)
     G.name = "Platonic Tetrahedral graph"
     return G
 
 
 def truncated_cube_graph(create_using=None):
-    """Returns the skeleton of the truncated cube."""
+    """
+    Returns the skeleton of the truncated cube.
+
+    The truncated cube is an Archimedean solid with 14 regular
+    faces (6 octagonal and 8 triangular), 36 edges and 24 nodes [1]_.
+    The truncated cube is created by truncating (cutting off) the tips
+    of the cube one third of the way into each edge [2]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Skeleton of the truncated cube
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Truncated_cube
+    .. [2] https://www.coolmath.com/reference/polyhedra-truncated-cube
+
+    """
     description = [
         "adjacencylist",
         "Truncated Cube Graph",
@@ -508,7 +927,28 @@ def truncated_cube_graph(create_using=None):
 
 
 def truncated_tetrahedron_graph(create_using=None):
-    """Returns the skeleton of the truncated Platonic tetrahedron."""
+    """
+    Returns the skeleton of the truncated Platonic tetrahedron.
+
+    The truncated tetrahedron is an Archimedean solid with 4 regular hexagonal faces,
+    4 equilateral triangle faces, 12 nodes and 18 edges. It can be constructed by truncating
+    all 4 vertices of a regular tetrahedron at one third of the original edge length [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Skeleton of the truncated tetrahedron
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Truncated_tetrahedron
+
+    """
     G = path_graph(12, create_using)
     #    G.add_edges_from([(1,3),(1,10),(2,7),(4,12),(5,12),(6,8),(9,11)])
     G.add_edges_from([(0, 2), (0, 9), (1, 6), (3, 11), (4, 11), (5, 7), (8, 10)])
@@ -517,7 +957,30 @@ def truncated_tetrahedron_graph(create_using=None):
 
 
 def tutte_graph(create_using=None):
-    """Returns the Tutte graph."""
+    """
+    Returns the Tutte graph.
+
+    The Tutte graph is a cubic polyhedral, non-Hamiltonian graph. It has
+    46 nodes and 69 edges.
+    It is a counterexample to Tait's conjecture that every 3-regular polyhedron
+    has a Hamiltonian cycle.
+    It can be realized geometrically from a tetrahedron by multiply truncating
+    three of its vertices [1]_.
+
+    Parameters
+    ----------
+    create_using : NetworkX graph constructor, optional (default=nx.Graph)
+       Graph type to create. If graph instance, then cleared before populated.
+
+    Returns
+    -------
+    G : networkx Graph
+        Tutte graph
+
+    References
+    ----------
+    .. [1] https://en.wikipedia.org/wiki/Tutte_graph
+    """
     description = [
         "adjacencylist",
         "Tutte's Graph",


Test patch: